Added some checks and balances to the indent script. Modified the standard indent slightly.
This commit is contained in:
Vendored
+1
-1
@@ -1 +1 @@
|
||||
-kr -nut -nlp
|
||||
-kr -nut -nlp -ip4 -cli4
|
||||
|
||||
+13
-5
@@ -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 '*~' )
|
||||
|
||||
Reference in New Issue
Block a user