X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=scripts%2Fmanage%2Fformat_source.sh;fp=scripts%2Fmanage%2Fformat_source.sh;h=5d407522efbc4e7a6b87bd2c86af50d671249852;hp=0000000000000000000000000000000000000000;hb=694f9bfbf7f1af19108461c7e00d133e55082bce;hpb=61c8d84d1c849373e0f115dc748ed45cff95287d diff --git a/scripts/manage/format_source.sh b/scripts/manage/format_source.sh new file mode 100755 index 00000000..5d407522 --- /dev/null +++ b/scripts/manage/format_source.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# format_source.sh dirname - indent the whole source tree +# format_source.sh filename - indent a single file + +if [ -d "$1" ]; then +#echo "Dir ${1} exists" + +file_list=`find ${1} -name "*.cpp" -or -name "*.h" -type f` +for file2indent in $file_list +do +echo "Indenting file $file2indent" +#!/bin/bash +uncrustify -f "$file2indent" -c "./format_source.cfg" -o indentoutput.tmp +mv indentoutput.tmp "$file2indent" + +done +else +if [ -f "$1" ]; then +echo "Indenting one file $1" +#!/bin/bash +uncrustify -f "$1" -c "./format_source.cfg" -o indentoutput.tmp +mv indentoutput.tmp "$1" + +else +echo "ERROR: As parameter given directory or file does not exist!" +echo "Syntax is: format_source.sh dirname filesuffix" +echo "Syntax is: format_source.sh filename" +echo "Example: format_source.sh temp cpp" +exit 1 +fi +fi