annotate TOOLS/checktree.sh @ 18419:40712b70206c

wording
author kraymer
date Tue, 09 May 2006 22:46:43 +0000
parents edffd6f8a022
children e3f7f221f75e
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
30 _cvs=yes
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
74 if [ "$_cvs" == "no" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
75 find . -type f \
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
76 | grep -v "\.\#\|\~$\|\.depend\|\/CVS\/\|config.mak\|^\./config\.h" \
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
77 | grep -v "^\./version\.h\|\.o$\|\.a$"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
78 else
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
79 list_cvs .
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
83 list_cvs() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
84 for i in `grep "^/" $1/CVS/Entries | cut -d '/' -f 2`; do
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
85 echo $1/$i
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
86 done
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
87 for j in `grep "^D/" $1/CVS/Entries | cut -d '/' -f 2`; do
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
88 list_cvs $1/$j
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
89 done
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
90 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
91
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
92 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
93
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
94 # Parse command line
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
95
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
96 for i in "$@"; do
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
97 case "$i" in
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
98 -help)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
99 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
100 echo -e "options:\n"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108 echo
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
109 printoption "all " "enable all tests" "no"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
110 echo
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
111 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
112 "$_showcont"
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
113 echo
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
114 printoption "color " "colored output" "$_color"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
115 printoption "head " "print heading for each test" "$_head"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
116 printoption "cvs " "use CVS/ to determine which files to check" \
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
117 "$_cvs"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
118 echo -e "\nIf no files are specified, the whole tree is traversed."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
119 echo -e "If there are, -(no)cvs has no effect.\n"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
120 exit
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
121 ;;
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
122 -charset)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
123 _charset=yes
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
124 ;;
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
125 -nocharset)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
126 _charset=no
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
127 ;;
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
128 -oll)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
129 _oll=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
130 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
131 -nooll)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
132 _oll=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
133 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
134 -cvs)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
135 _cvs=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
136 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
137 -nocvs)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
138 _cvs=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
139 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
140 -head)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
141 _head=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
142 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
143 -nohead)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
144 _head=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
145 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
146 -color)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
147 _color=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
148 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
149 -nocolor)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
150 _color=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
151 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
152 -spaces)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
153 _spaces=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
154 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
155 -nospaces)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
156 _spaces=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
157 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
158 -extensions)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
159 _extensions=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
160 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
161 -noextensions)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
162 _extensions=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
163 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
164 -crlf)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
165 _crlf=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
166 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
167 -nocrlf)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
168 _crlf=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
169 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
170 -trailws)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
171 _trailws=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
172 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
173 -notrailws)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
174 _trailws=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
175 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
176 -rcsid)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
177 _rcsid=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
178 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
179 -norcsid)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
180 _rcsid=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
181 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
182 -all)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
183 enable_all_tests
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
184 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
185 -noall)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
186 disable_all_tests
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
187 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
188 -none)
16405
ivo
parents: 16240
diff changeset
189 disable_all_tests
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
190 ;;
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
191 -showcont)
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
192 _showcont=yes
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
193 ;;
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
194 -noshowcont)
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
195 _showcont=no
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
196 ;;
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
197 -*)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
198 echo "unknown option: $i" >&2
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
199 exit 0
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
200 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
201 *)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
202 _files="$_files $i"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
203 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
204 esac
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
205 done
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
206
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 # Set heading color
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 if [ "$_color" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
212 COLB="\e[36m"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
213 COLE="\e[m"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
214 else
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
215 COLB=""
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
216 COLE=""
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
217 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
218
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
219 # Generate filelist once so -cvs isn't _that_ much slower than -nocvs anymore
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
220
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
221 filelist=`all_filenames`
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
222
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
223 if [ "$_showcont" == "yes" ]; then
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
224 _diffopts="-u"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
225 _grepopts="-n -I"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
226 else
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
227 _diffopts="-q"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
228 _grepopts="-l -I"
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
229 fi
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
230
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
231 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
232
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
233 # DO CHECKS
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
234
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
235 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
236
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
237 if [ "$_spaces" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
238 printhead "checking for spaces in filenames ..."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
239 find . | grep " "
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
240 fi
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 [ "$_extensions" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
245 printhead "checking for uppercase extensions ..."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
246 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
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 [ "$_crlf" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
252 printhead "checking for MSDOS line endings ..."
18087
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
253 grep $_grepopts "
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
254 " $filelist
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
255 fi
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
259 if [ "$_trailws" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
260 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
261 grep $_grepopts "[[:space:]]\+$" $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 [ "$_rcsid" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
267 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
268 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
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 [ "$_oll" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
274 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
275 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
276 fi
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
277
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
278 # -----------------------------------------------------------------------------
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
279
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
280 if [ "$_charset" == "yes" ]; then
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
281 printhead "checking bad charsets ..."
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
282 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
283 case "$I" in
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
284 ./help/help_mp-*.h)
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 ./DOCS/*)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
287 ;;
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
288 *.c|*.h)
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
289 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
290 ;;
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
291 esac
edffd6f8a022 add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents: 17131
diff changeset
292 done
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
293 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
294
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
295 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
296
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
297 # End
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
298