From ecc26d4590ec3549527be2f06c7b486a047e38ad Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 25 Jul 2007 20:54:23 +0000 Subject: [PATCH] Added some checks and balances to the indent script. Modified the standard indent slightly. --- bacnet-stack/.indent.pro | 2 +- bacnet-stack/indent.sh | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bacnet-stack/.indent.pro b/bacnet-stack/.indent.pro index 730092bc..9baced44 100644 --- a/bacnet-stack/.indent.pro +++ b/bacnet-stack/.indent.pro @@ -1 +1 @@ --kr -nut -nlp +-kr -nut -nlp -ip4 -cli4 diff --git a/bacnet-stack/indent.sh b/bacnet-stack/indent.sh index ec58d1ea..d1ec15ec 100755 --- a/bacnet-stack/indent.sh +++ b/bacnet-stack/indent.sh @@ -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 '*~' )