X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=pre-commit;h=5213f2cf4520930e21b1f2df302c145dd9ac6f30;hb=67a8e21eedb6d35fec76841d4a1a6b4b41b37879;hp=b733c44fa1fd20889930e483f5fa36983fc76949;hpb=0a217a8df1657b4334b55b0e4a6c7837a8dbcfd9;p=oweals%2Fgnunet.git diff --git a/pre-commit b/pre-commit index b733c44fa..5213f2cf4 100755 --- a/pre-commit +++ b/pre-commit @@ -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 -