typo
[oweals/gnunet.git] / pre-commit
index b733c44fa1fd20889930e483f5fa36983fc76949..5213f2cf4520930e21b1f2df302c145dd9ac6f30 100755 (executable)
@@ -1,17 +1,21 @@
 #!/bin/sh
-# NOTE: "touch mydir/no-indent" to make the tree starting at mydir untouchable
-l=""
-for n in `find . -name "no-indent"`
-do
-  n=`dirname "$n"`
-  l="-and -not -path \"$n/*\" $l"
-done
-indent -nut `echo $l | xargs find . -name "*.c"`
-indent -nut `echo $l | xargs find . -name "*.h"`
+# Run this script to indent the GNUnet code.  When run without arguments,
+# it indents the ENTIRE src/ tree.  Run with 'src/XXX' to indent the
+# src/XXX directory.
+if test $# = 0
+then
+ PATHS=src/
+else
+ PATHS="$@"
+fi
+find $PATHS -name "*.c" -exec indent {} \;
+find $PATHS -name "*.h" -exec indent {} \;
+find $PATHS -name "*.c" -exec indent {} \;
+find $PATHS -name "*.h" -exec indent {} \;
+find $PATHS -name "*.c" -exec contrib/removetrailingwhitespace {} \;
+find $PATHS -name "*.h" -exec contrib/removetrailingwhitespace {} \;
 if test -x "`which 'dos2unix'`"
 then
-  dos2unix -ko `echo $l | xargs find . -name "*.c"`
-  dos2unix -ko `echo $l | xargs find . -name "*.h"`
-  rm `echo $l | xargs find . -name "*.?~"`
+  find $PATHS -name "*.c" -exec dos2unix {} \;
+  find $PATHS -name "*.h" -exec dos2unix {} \;
 fi
-