diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-08-29 10:24:13 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-08-29 10:24:13 +0000 |
commit | a7c58475a70153e053b5bc8703ca297edada9c0f (patch) | |
tree | 6901070f26f20199b473af026a282261d8323c7b | |
parent | e190fcfc9e60ac1079d6ce6ff64fc7c40aeed275 (diff) |
improved script
git-svn-id: https://gnunet.org/svn/gnunet@16621 140774ce-b5e7-0310-ab8b-a85725594a96
-rwxr-xr-x | pre-commit | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/pre-commit b/pre-commit index ed24552373..5213f2cf45 100755 --- a/pre-commit +++ b/pre-commit @@ -1,12 +1,21 @@ #!/bin/sh -find src/ -name "*.c" -exec indent {} \; -find src/ -name "*.h" -exec indent {} \; -find src/ -name "*.c" -exec indent {} \; -find src/ -name "*.h" -exec indent {} \; -find src/ -name "*.c" -exec contrib/removetrailingwhitespace {} \; -find src/ -name "*.h" -exec contrib/removetrailingwhitespace {} \; +# 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 - find src/ -name "*.c" -exec dos2unix {} \; - find src/ -name "*.h" -exec dos2unix {} \; + find $PATHS -name "*.c" -exec dos2unix {} \; + find $PATHS -name "*.h" -exec dos2unix {} \; fi |