changeset 18087:edffd6f8a022

add check for non-ascii charsets used in code and simplify showcont switch handling
author reimar
date Fri, 14 Apr 2006 10:47:40 +0000
parents 69e7ff186783
children 18d57fb6d320
files TOOLS/checktree.sh
diffstat 1 files changed, 38 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/TOOLS/checktree.sh	Fri Apr 14 07:36:27 2006 +0000
+++ b/TOOLS/checktree.sh	Fri Apr 14 10:47:40 2006 +0000
@@ -22,6 +22,7 @@
 _trailws=no
 _rcsid=no
 _oll=no
+_charset=no
 _showcont=no
 
 _color=yes
@@ -46,6 +47,7 @@
     _trailws=yes
     _rcsid=yes
     _oll=yes
+    _charset=yes
 }
 
 disable_all_tests() {
@@ -55,6 +57,7 @@
     _trailws=no
     _rcsid=no
     _oll=no
+    _charset=no
 }
 
 printoption() {
@@ -101,6 +104,7 @@
         printoption "trailws   " "test for trailing whitespace" "$_trailws"
         printoption "rcsid     " "test for missing RCS Id's" "$_rcsid"
         printoption "oll       " "test for overly long lines" "$_oll"
+        printoption "charset   " "test for wrong charset" "$_charset"
         echo
         printoption "all       " "enable all tests" "no"
         echo
@@ -115,6 +119,12 @@
         echo -e "If there are, -(no)cvs has no effect.\n"
         exit
         ;;
+    -charset)
+        _charset=yes
+        ;;
+    -nocharset)
+        _charset=no
+        ;;
     -oll)
         _oll=yes
         ;;
@@ -210,6 +220,14 @@
 
 filelist=`all_filenames`
 
+if [ "$_showcont" == "yes" ]; then
+  _diffopts="-u"
+  _grepopts="-n -I"
+else
+  _diffopts="-q"
+  _grepopts="-l -I"
+fi
+
 # -----------------------------------------------------------------------------
 
 # DO CHECKS
@@ -232,24 +250,15 @@
 
 if [ "$_crlf" == "yes" ]; then
     printhead "checking for MSDOS line endings ..."
-    if [ "$_showcont" == "yes" ]; then
-        grep -n -I "
+    grep $_grepopts "
 " $filelist
-    else
-    grep -l -I "
-" $filelist
-    fi
 fi
 
 # -----------------------------------------------------------------------------
 
 if [ "$_trailws" == "yes" ]; then
     printhead "checking for trailing whitespace ..."
-    if [ "$_showcont" == "yes" ]; then
-        grep -n -I "[[:space:]]\+$" $filelist
-    else
-    grep -l -I "[[:space:]]\+$" $filelist
-    fi
+    grep $_grepopts "[[:space:]]\+$" $filelist
 fi
 
 # -----------------------------------------------------------------------------
@@ -263,11 +272,24 @@
 
 if [ "$_oll" == "yes" ]; then
     printhead "checking for overly long lines (over 79 characters) ..."
-    if [ "$_showcont" == "yes" ]; then
-        grep -n -I "^[[:print:]]\{80,\}$" $filelist
-    else
-    grep -l -I "^[[:print:]]\{80,\}$" $filelist
-    fi
+    grep $_grepopts "^[[:print:]]\{80,\}$" $filelist
+fi
+
+# -----------------------------------------------------------------------------
+
+if [ "$_charset" == "yes" ]; then
+    printhead "checking bad charsets ..."
+    for I in $filelist ; do
+      case "$I" in
+        ./help/help_mp-*.h)
+          ;;
+        ./DOCS/*)
+          ;;
+        *.c|*.h)
+          iconv -c -f ascii -t ascii "$I" | diff $_diffopts "$I" -
+          ;;
+      esac
+    done
 fi
 
 # -----------------------------------------------------------------------------