annotate TOOLS/checktree.sh @ 19079:0ba020beb2e4

fix matching of MSDOS line endings The CVS-->Subversion conversion removed the ^M and it is impossible to check one back in. Setting svn:eol-style to CRLF or CR is not an option because it will change the whole file.
author ivo
date Fri, 14 Jul 2006 15:08:31 +0000
parents 4361813f6cae
children 6ff62e005cba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
1 #!/bin/sh
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
2
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
3 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
4
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
5 # Check source-tree for anomalies
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
6 #
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
7 # (C)opyright 2005 by Ivo van Poorten
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
8 # Licensed under GNU General Public License version 2
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
9 #
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
10 # Thanks to Melchior Franz of the FlightGear project for the original idea
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
11 # of a source-tree checker and Torinthiel for the feedback along the way.
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
12
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
13 # $Id$
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
14
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
15 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
16
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
17 # Default settings
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
18
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
19 _spaces=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
20 _extensions=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
21 _crlf=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
22 _trailws=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
23 _rcsid=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
24 _oll=no
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
25 _charset=no
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
26 _showcont=no
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
27
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
28 _color=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
29 _head=yes
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
30 _svn=yes
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
31 _files=
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
32
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
33 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
34
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
35 # Avoid locale problems
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
36
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
37 export LC_ALL=C
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
38
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
39 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
40
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
41 # Helper functions
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
42
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
43 enable_all_tests() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
44 _spaces=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
45 _extensions=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
46 _crlf=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
47 _trailws=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
48 _rcsid=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
49 _oll=yes
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
50 _charset=yes
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
51 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
52
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
53 disable_all_tests() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
54 _spaces=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
55 _extensions=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
56 _crlf=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
57 _trailws=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
58 _rcsid=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
59 _oll=no
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
60 _charset=no
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
61 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
62
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
63 printoption() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
64 echo " -(no)$1 $2 [default: $3]"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
65 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
66
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
67 printhead() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
68 test "$_head" = "yes" && echo -e "$COLB$1$COLE"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
69 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
70
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
71 all_filenames() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
72 test "$_files" != "" && echo "$_files" && return
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
73
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
74 if [ "$_svn" == "no" ]; then
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
75 find . -type f \
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
76 | grep -v "\.\#\|\~$\|\.depend\|\/\.svn\/\|config.mak\|^\./config\.h" \
19078
4361813f6cae also omit configure.log and the generated help_mp.h from files to check
ivo
parents: 19077
diff changeset
77 | grep -v "^\./version\.h\|\.o$\|\.a$\|configure.log\|^\./help_mp.h"
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
78 else
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
79 list_svn .
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
80 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
81 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
82
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
83 list_svn() {
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
84 tmpfiles=`sed '/name/ba; /kind/ba; d; b;
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
85 :a; s/^ *....=\"\(.*\)\".*$/\1/;' $1/.svn/entries | \
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
86 sed '/$/N; s/\n/ /; / dir$/d; s/ file$//;'`
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
87 tmpdirs=`sed ' /name/ba; /kind/ba; d; b;
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
88 :a; s/^ *....=\"\(.*\)\".*$/\1/;' $1/.svn/entries | \
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
89 sed ' /$/N; s/\n/ /; / file$/d; /^ dir$/d; s/ dir$//;'`
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
90
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
91 for i in $tmpfiles; do
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
92 echo $1/$i
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
93 done
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
94 for j in $tmpdirs; do
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
95 list_svn $1/$j
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
96 done
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
97 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
98
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
99 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
100
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
101 # Parse command line
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
102
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
103 for i in "$@"; do
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
104 case "$i" in
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
105 -help)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
106 echo -e "\n$0 [options] [files]\n"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
107 echo -e "options:\n"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
108 printoption "spaces " "test for spaces in filenames" "$_spaces"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
109 printoption "extensions" "test for uppercase extensions" "$_extensions"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
110 printoption "crlf " "test for MSDOS line endings" "$_crlf"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
111 printoption "trailws " "test for trailing whitespace" "$_trailws"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
112 printoption "rcsid " "test for missing RCS Id's" "$_rcsid"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
113 printoption "oll " "test for overly long lines" "$_oll"
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
114 printoption "charset " "test for wrong charset" "$_charset"
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
115 echo
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
116 printoption "all " "enable all tests" "no"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
117 echo
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
118 printoption "showcont " "show offending content of file(s)" \
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
119 "$_showcont"
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
120 echo
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
121 printoption "color " "colored output" "$_color"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
122 printoption "head " "print heading for each test" "$_head"
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
123 printoption "svn " "use .svn/ to determine which files to " \
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
124 "check" "$_svn"
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
125 echo -e "\nIf no files are specified, the whole tree is traversed."
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
126 echo -e "If there are, -(no)svn has no effect.\n"
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
127 exit
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
128 ;;
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
129 -charset)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
130 _charset=yes
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
131 ;;
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
132 -nocharset)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
133 _charset=no
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
134 ;;
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
135 -oll)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
136 _oll=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
137 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
138 -nooll)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
139 _oll=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
140 ;;
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
141 -svn)
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
142 _svn=yes
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
143 ;;
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
144 -nosvn)
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
145 _svn=no
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
146 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
147 -head)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
148 _head=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
149 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
150 -nohead)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
151 _head=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
152 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
153 -color)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
154 _color=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
155 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
156 -nocolor)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
157 _color=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
158 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
159 -spaces)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
160 _spaces=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
161 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
162 -nospaces)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
163 _spaces=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
164 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
165 -extensions)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
166 _extensions=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
167 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
168 -noextensions)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
169 _extensions=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
170 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
171 -crlf)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
172 _crlf=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
173 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
174 -nocrlf)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
175 _crlf=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
176 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
177 -trailws)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
178 _trailws=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
179 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
180 -notrailws)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
181 _trailws=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
182 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
183 -rcsid)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
184 _rcsid=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
185 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
186 -norcsid)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
187 _rcsid=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
188 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
189 -all)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
190 enable_all_tests
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
191 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
192 -noall)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
193 disable_all_tests
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
194 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
195 -none)
16405
ivo
parents: 16240
diff changeset
196 disable_all_tests
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
197 ;;
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
198 -showcont)
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
199 _showcont=yes
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
200 ;;
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
201 -noshowcont)
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
202 _showcont=no
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
203 ;;
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
204 -*)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
205 echo "unknown option: $i" >&2
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
206 exit 0
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
207 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
208 *)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
209 _files="$_files $i"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
210 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
211 esac
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
212 done
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
213
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
214 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
215
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
216 # Set heading color
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
217
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
218 if [ "$_color" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
219 COLB="\e[36m"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
220 COLE="\e[m"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
221 else
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
222 COLB=""
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
223 COLE=""
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
224 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
225
19077
e3f7f221f75e CVS --> Subversion
ivo
parents: 18087
diff changeset
226 # Generate filelist once so -svn isn't _that_ much slower than -nosvn anymore
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
227
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
228 filelist=`all_filenames`
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
229
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
230 if [ "$_showcont" == "yes" ]; then
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
231 _diffopts="-u"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
232 _grepopts="-n -I"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
233 else
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
234 _diffopts="-q"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
235 _grepopts="-l -I"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
236 fi
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
237
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
238 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
239
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
240 # DO CHECKS
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
241
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
242 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
243
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
244 if [ "$_spaces" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
245 printhead "checking for spaces in filenames ..."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
246 find . | grep " "
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
247 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
248
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
249 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
250
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
251 if [ "$_extensions" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
252 printhead "checking for uppercase extensions ..."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
253 echo $filelist | grep "\.[[:upper:]]\+$" | grep -v "\.S$"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
254 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
255
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
256 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
257
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
258 if [ "$_crlf" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
259 printhead "checking for MSDOS line endings ..."
19079
0ba020beb2e4 fix matching of MSDOS line endings
ivo
parents: 19078
diff changeset
260 CR=`echo " " | tr ' ' '\015'`
0ba020beb2e4 fix matching of MSDOS line endings
ivo
parents: 19078
diff changeset
261 grep $_grepopts "$CR" $filelist
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
262 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
263
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
264 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
265
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
266 if [ "$_trailws" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
267 printhead "checking for trailing whitespace ..."
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
268 grep $_grepopts "[[:space:]]\+$" $filelist
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
269 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
270
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
271 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
272
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
273 if [ "$_rcsid" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
274 printhead "checking for missing RCS \$Id\$ or \$Revision\$ tags ..."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
275 grep -L -I "\$\(Id\|Revision\)[[:print:]]\+\$" $filelist
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
276 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
277
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
278 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
279
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
280 if [ "$_oll" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
281 printhead "checking for overly long lines (over 79 characters) ..."
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
282 grep $_grepopts "^[[:print:]]\{80,\}$" $filelist
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
283 fi
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
284
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
285 # -----------------------------------------------------------------------------
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
286
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
287 if [ "$_charset" == "yes" ]; then
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
288 printhead "checking bad charsets ..."
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
289 for I in $filelist ; do
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
290 case "$I" in
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
291 ./help/help_mp-*.h)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
292 ;;
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
293 ./DOCS/*)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
294 ;;
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
295 *.c|*.h)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
296 iconv -c -f ascii -t ascii "$I" | diff $_diffopts "$I" -
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
297 ;;
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
298 esac
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
299 done
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
300 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
301
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
302 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
303
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
304 # End
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
305