Added some checks and balances to the indent script. Modified the standard indent slightly.

This commit is contained in:
skarg
2007-07-25 20:54:23 +00:00
parent 33113601fe
commit ecc26d4590
2 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
-kr -nut -nlp
-kr -nut -nlp -ip4 -cli4
+13 -5
View File
@@ -1,22 +1,30 @@
#!/bin/sh
# indent uses a local indent.pro file if it exists
# echo "-kr -nut -nlp" > .indent.pro
# exit silently if utility is not installed
[ -x /usr/bin/indent ] || exit 0
[ -x /usr/bin/dos2unix ] || exit 0
if [ ! -x .indent.pro ]
then
echo "-kr -nut -nlp -ip4 -cli4" > .indent.pro
fi
directory=${1-`pwd`}
for filename in $( find $directory -name '*.c' )
do
echo Fixing DOS/Unix $filename
dos2unix $filename
/usr/bin/dos2unix $filename
echo Indenting $filename
indent -kr -nut -nlp $filename
/usr/bin/indent $filename
done
for filename in $( find $directory -name '*.h' )
do
echo Fixing DOS/Unix $filename
dos2unix $filename
/usr/bin/dos2unix $filename
echo Indenting $filename
indent -kr -nut -nlp $filename
/usr/bin/indent $filename
done
for filename in $( find $directory -name '*~' )