2009-12-19 07:28:26 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check that we have no tabs or trailing spaces in the source code
|
|
|
|
#
|
2011-06-18 06:41:59 -04:00
|
|
|
nfails=0
|
|
|
|
nfiles=0
|
|
|
|
nlines=0
|
2009-12-19 07:28:26 -05:00
|
|
|
for dir in lib/misc lib/unix lib/xlib lib/xwidgets lib/xwidgets/motif \
|
|
|
|
lib/xwidgets/xaw src; do
|
2011-06-18 06:41:59 -04:00
|
|
|
if [ ! -d "../$dir" ]; then continue; fi
|
|
|
|
for x in $(make -s echo-sources -C ../$dir); do
|
|
|
|
case "$x" in
|
|
|
|
*.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|.py|.pl)
|
|
|
|
nfiles=$(($nfiles + 1));
|
|
|
|
nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;;
|
|
|
|
*)
|
|
|
|
continue ;;
|
|
|
|
esac
|
|
|
|
if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then
|
2009-12-19 07:28:26 -05:00
|
|
|
echo "error: $dir/$x contains trailing spaces"
|
2011-06-18 06:41:59 -04:00
|
|
|
nfails=$(($nfails + 1))
|
2009-12-19 07:28:26 -05:00
|
|
|
fi
|
2011-06-18 06:41:59 -04:00
|
|
|
if grep ' ' "../$dir/$x" >/dev/null 2>&1; then
|
2009-12-19 07:28:26 -05:00
|
|
|
echo "error: $dir/$x contains tabs"
|
2011-06-18 06:41:59 -04:00
|
|
|
nfails=$(($nfails + 1))
|
2009-12-19 07:28:26 -05:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2011-06-18 06:41:59 -04:00
|
|
|
echo "$nfiles files, $nlines lines, $nfails errors in source code"
|
|
|
|
|
|
|
|
if test "$nfails" != "0"; then
|
2009-12-19 07:28:26 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|