2010-01-28 12:19:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Run astyle on the code base ready for release
|
|
|
|
|
2010-01-28 14:23:35 +00:00
|
|
|
# If astyle doesn't exist, exit the script and do nothing
|
|
|
|
echo "FOO" | astyle > /dev/null
|
|
|
|
RET=$?
|
|
|
|
if [ $RET -ne 0 ]; then
|
|
|
|
echo "Could not find astyle - aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2010-02-23 15:21:45 +00:00
|
|
|
|
|
|
|
RET=`astyle --version 2>&1`
|
|
|
|
if [ "$RET" != "Artistic Style Version 1.23" ]; then
|
|
|
|
echo "Only 1.23 astyle version is 'allowed'"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2010-01-28 12:19:04 +00:00
|
|
|
# Find all "pure" C files in the codebase
|
|
|
|
# - not .in.c used for .sql generation
|
|
|
|
# - not lex.yy.c or wktparse.tab.c as these are generated files
|
2012-02-22 23:13:20 +00:00
|
|
|
CFILES=`find . -name '*.c' -not \( -name '*.in.c' -o -name '*_parse.c' -o -name '*_lex.c' \)`
|
2010-01-28 12:19:04 +00:00
|
|
|
|
2010-02-01 17:35:55 +00:00
|
|
|
# Run the standard format on the files, and do not
|
|
|
|
# leave .orig files around for altered files.
|
|
|
|
astyle --style=ansi --indent=tab --suffix=none $CFILES
|