ENH: add Java j2kviewer but do not compile it using cmake since cmake has too poor...
[openjpeg.git] / CVSROOT / checkCtrlM
1 #!/bin/sh
2 #
3 # checkCtrlM checks source code for explicit ctrl-M's
4 #   checks only files with the following extensions: .c, .cxx, .txx, .html, .htm
5 #   exits with 0, if all commited files pass the test.
6 #   exits with 1, if any one of the tests fails
7 #
8 # checkCtrlM can be run as a cvs commitinfo command.
9 # The following commitinfo line (without the #) will run the script
10 # ALL   $CVSROOT/CVSROOT/checkCtrlM
11
12 failed=0
13 #
14 # skip the first arg, the directory
15 shift 1
16
17 for file in "$@"; do
18   #
19   # select files with extentions .txx, .cxx, .h, .html, .htm, .c, .txt, .cmake
20   match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]html\$\|\[\.\]htm\$\|\[\.\]c\$\|\[\.\]txt\$\|\[\.\]cmake\$`
21   if [ "x$match" != "x" ] ; then
22     count=`grep -n 
23 \$ /dev/null $file|wc -c`
24     results=`expr $count \| 0`
25     if [ "$results" != "0" ]; then
26       echo "=========================================================="
27       if [ $results -lt 200 ]; then
28         grep -n 
29 \$ /dev/null $file
30       fi
31       echo ""
32       echo "$file has ^M's. They must be removed before you can commit."
33       echo "The problem count was $results"
34       echo "=========================================================="
35       failed=1
36     fi
37   fi
38 done
39 exit $failed