Debian Codegraph @

lab/tabcheck

raw symbols SCIP
1 #! /bin/sh
2
3 #================================================================
4 # tabcheck
5 # Find files including dispensable tab and space characters
6 #================================================================
7
8
9 # set variables
10 regex='(\.h|\.c|\.cc|\.cpp|\.cxx|\.java|\.pl|\.pm|\.pod|\.rb|\.rd)$'
11 tabcode=`printf '\t'`
12
13
14 # find tab
15 find . -type f | egrep $regex |
16 while read file
17 do
18 printf 'Checking %s ... ' $file
19 err=0
20 if grep "$tabcode" $file > /dev/null
21 then
22 printf '### !!! TAB FOUND !!! ###'
23 err=1
24 fi
25 if grep ' $' $file > /dev/null
26 then
27 printf '### !!! TAILING SPACE FOUND !!! ###'
28 err=1
29 fi
30 [ "$err" = 0 ] && printf 'ok'
31 printf '\n'
32 done
33
34
35 # exit normally
36 exit 0
37
38
39
40 # END OF FILE