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
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
14 # skip the first arg, the directory
15 foreach file ( $argv[2-] )
17 # select files with extentions .txx, .cxx, .h, .html, .htm
18 set match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]cpp\$\|\[\.\]htm\$\|\[\.\]html\$\|\[\.\]c\$\|\[\.\]mm\$\|\[\.\]h.in\$\|\[\.\]hxx.in\$\|CMakeLists.txt\$\|\[\.\]cmake\$\|\[\.\]cmake.in\$`
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 grep -n " " /dev/null $file
26 echo "$file has explicit TABSs."
27 echo "They must be converted to SPACES(2 per TAB) before you can commit."
28 echo "=========================================================="