Don't change files if they're unmodified.
Indicate which files have changed and a summary.
Reviewed-by: Rich Salz <rsalz@openssl.org>
DONT=false
STOPARGS=false
COMMENTS=false
DONT=false
STOPARGS=false
COMMENTS=false
DEBUG=""
# for this exercise, we want to force the openssl style, so we roll
DEBUG=""
# for this exercise, we want to force the openssl style, so we roll
- if [ "$VERBOSE" = "true" ]; then
- echo "$j"
- fi
-
if [ "$DONT" = "false" ]; then
tmp=$(mktemp /tmp/indent.XXXXXX)
trap 'rm -f "$tmp"' HUP INT TERM EXIT
if [ "$DONT" = "false" ]; then
tmp=$(mktemp /tmp/indent.XXXXXX)
trap 'rm -f "$tmp"' HUP INT TERM EXIT
else
expand "$j" | indent $INDENT_ARGS > "$tmp"
fi;
else
expand "$j" | indent $INDENT_ARGS > "$tmp"
fi;
+ if cmp -s "$tmp" "$j"; then
+ if [ "$VERBOSE" = "true" ]; then
+ echo "$j unchanged"
+ fi
+ rm "$tmp"
+ else
+ if [ "$VERBOSE" = "true" ]; then
+ echo "$j changed"
+ fi
+ CHANGED=true
+ mv "$tmp" "$j"
+ fi
+if [ "$VERBOSE" = "true" ]; then
+ echo
+ if [ "$CHANGED" = "true" ]; then
+ echo "SOURCE WAS MODIFIED"
+ else
+ echo "SOURCE WAS NOT MODIFIED"
+ fi
+fi