removed pre-commit check tabs
[openjpeg.git] / CVSROOT / checktabs.sh
1 #!/bin/tcsh
2 #
3 # checkTabs checks source code for explicit TABS
4 # checks only files with the following extensions: .c, .cxx, .txx,
5 # exits with 0, if all commited files pass the test.
6 # exits with 1, if any one of the tests fails
7 #
8 # checkTabs can be run as a cvs commitinfo command.
9 # The following commitinfo line (without the #) will run the script
10 # ALL $CVSROOT/CVSROOT/checkTabs
11 #
12 set failed=0
13 #
14 # skip the first arg, the directory
15 foreach file ( $argv[2-] )
16 #
17 # select files with extentions .txx, .cxx, .h, .html, .htm
18 set match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]c\$`
19 if ( $match == "" ) continue;
20 set count=`grep -n "    " /dev/null $file|wc -c`
21 set results=`expr $count \| 0`
22 if ( "$results" != "0" ) then
23         echo
24 "=========================================================="
25         grep -n "       " /dev/null $file
26         echo ""
27         echo "$file has explicit TABSs."
28         echo "They must be converted to SPACES(2 per TAB) before you can commit."
29         echo
30 "=========================================================="
31         set failed=1
32 endif
33 end
34 exit $failed