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
|
#!/bin/sh
|
||||||
# indent uses a local indent.pro file if it exists
|
# 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`}
|
directory=${1-`pwd`}
|
||||||
for filename in $( find $directory -name '*.c' )
|
for filename in $( find $directory -name '*.c' )
|
||||||
do
|
do
|
||||||
echo Fixing DOS/Unix $filename
|
echo Fixing DOS/Unix $filename
|
||||||
dos2unix $filename
|
/usr/bin/dos2unix $filename
|
||||||
echo Indenting $filename
|
echo Indenting $filename
|
||||||
indent -kr -nut -nlp $filename
|
/usr/bin/indent $filename
|
||||||
done
|
done
|
||||||
|
|
||||||
for filename in $( find $directory -name '*.h' )
|
for filename in $( find $directory -name '*.h' )
|
||||||
do
|
do
|
||||||
echo Fixing DOS/Unix $filename
|
echo Fixing DOS/Unix $filename
|
||||||
dos2unix $filename
|
/usr/bin/dos2unix $filename
|
||||||
echo Indenting $filename
|
echo Indenting $filename
|
||||||
indent -kr -nut -nlp $filename
|
/usr/bin/indent $filename
|
||||||
done
|
done
|
||||||
|
|
||||||
for filename in $( find $directory -name '*~' )
|
for filename in $( find $directory -name '*~' )
|
||||||
|
|||||||
Reference in New Issue
Block a user