Mercurial > mplayer.hg
annotate TOOLS/checktree.sh @ 23939:f85dd30807a3
cosmetics, break overly long lines
author | ivo |
---|---|
date | Tue, 31 Jul 2007 08:11:18 +0000 |
parents | 0239a594ec45 |
children | 1b3e61a77754 |
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 |
23235 | 22 _tabs=no |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
23 _trailws=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
24 _rcsid=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
25 _oll=no |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
26 _charset=no |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
27 _stupid=no |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
28 _showcont=no |
23927 | 29 _gnu=no |
23935 | 30 _res=no |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
31 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
32 _color=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
33 _head=yes |
19077 | 34 _svn=yes |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
35 _files= |
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 # ----------------------------------------------------------------------------- |
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 # Avoid locale problems |
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 export LC_ALL=C |
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 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
44 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
45 # Helper functions |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
46 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
47 enable_all_tests() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
48 _spaces=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
49 _extensions=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
50 _crlf=yes |
23235 | 51 _tabs=yes |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
52 _trailws=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
53 _rcsid=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
54 _oll=yes |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
55 _charset=yes |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
56 _stupid=yes |
23927 | 57 _gnu=yes |
23935 | 58 _res=yes |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
59 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
60 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
61 disable_all_tests() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
62 _spaces=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
63 _extensions=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
64 _crlf=no |
23235 | 65 _tabs=no |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
66 _trailws=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
67 _rcsid=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
68 _oll=no |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
69 _charset=no |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
70 _stupid=no |
23927 | 71 _gnu=no |
23935 | 72 _res=no |
16240
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 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
75 printoption() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
76 echo " -(no)$1 $2 [default: $3]" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
77 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
78 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
79 printhead() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
80 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
|
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 all_filenames() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
84 test "$_files" != "" && echo "$_files" && return |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
85 |
20204 | 86 if [ "$_svn" = "no" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
87 find . -type f \ |
19077 | 88 | 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
|
89 | 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
|
90 else |
22361
eec955510da7
do not rely on svn internals and use svn info instead
ivo
parents:
22359
diff
changeset
|
91 svn info -R | sed -n '/Path:/bb; :a; d; b; :b; s/Path: /.\//; h; :c; n; |
eec955510da7
do not rely on svn internals and use svn info instead
ivo
parents:
22359
diff
changeset
|
92 /Node Kind:/bd; bc; :d; /directory/ba; g; p;' |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
93 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
94 } |
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 # ----------------------------------------------------------------------------- |
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 # Parse command line |
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 for i in "$@"; do |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
101 case "$i" in |
22359
206b4600a956
also respond to --help, -h and -? command line options
ivo
parents:
22358
diff
changeset
|
102 -help|--help|-h|-\?) |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
103 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
|
104 echo -e "options:\n" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
105 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
|
106 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
|
107 printoption "crlf " "test for MSDOS line endings" "$_crlf" |
23235 | 108 printoption "tabs " "test for tab characters" "$_tabs" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
109 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
|
110 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
|
111 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
|
112 printoption "charset " "test for wrong charset" "$_charset" |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
113 printoption "stupid " "test for stupid code" "$_stupid" |
23927 | 114 printoption "gnu " "test for GNUisms" "$_gnu" |
23935 | 115 printoption "res " "test for reserved identifiers" "$_res" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
116 echo |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
117 printoption "all " "enable all tests" "no" |
22357 | 118 echo " (-noall can be specified as -none)" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
119 echo |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
120 printoption "showcont " "show offending content of file(s)" \ |
19080 | 121 "$_showcont" |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
122 echo |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
123 printoption "color " "colored output" "$_color" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
124 printoption "head " "print heading for each test" "$_head" |
22509 | 125 printoption "svn " \ |
22361
eec955510da7
do not rely on svn internals and use svn info instead
ivo
parents:
22359
diff
changeset
|
126 "use svn info to determine which files to check" "$_svn" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
127 echo -e "\nIf no files are specified, the whole tree is traversed." |
19077 | 128 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
|
129 exit |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
130 ;; |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
131 -stupid) |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
132 _stupid=yes |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
133 ;; |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
134 -nostupid) |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
135 _stupid=no |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
136 ;; |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
137 -charset) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
138 _charset=yes |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
139 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
140 -nocharset) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
141 _charset=no |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
142 ;; |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
143 -oll) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
144 _oll=yes |
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 -nooll) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
147 _oll=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
148 ;; |
19077 | 149 -svn) |
150 _svn=yes | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
151 ;; |
19077 | 152 -nosvn) |
153 _svn=no | |
16240
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 -head) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
156 _head=yes |
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 -nohead) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
159 _head=no |
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 -color) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
162 _color=yes |
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 -nocolor) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
165 _color=no |
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 -spaces) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
168 _spaces=yes |
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 -nospaces) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
171 _spaces=no |
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 -extensions) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
174 _extensions=yes |
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 -noextensions) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
177 _extensions=no |
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 -crlf) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
180 _crlf=yes |
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 -nocrlf) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
183 _crlf=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
184 ;; |
23235 | 185 -tabs) |
186 _tabs=yes | |
187 ;; | |
188 -notabs) | |
189 _tabs=no | |
190 ;; | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
191 -trailws) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
192 _trailws=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
193 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
194 -notrailws) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
195 _trailws=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
196 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
197 -rcsid) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
198 _rcsid=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
199 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
200 -norcsid) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
201 _rcsid=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
202 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
203 -all) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
204 enable_all_tests |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
205 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
206 -noall) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
207 disable_all_tests |
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 -none) |
16405 | 210 disable_all_tests |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
211 ;; |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
212 -showcont) |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
213 _showcont=yes |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
214 ;; |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
215 -noshowcont) |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
216 _showcont=no |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
217 ;; |
23927 | 218 -gnu) |
219 _gnu=yes | |
220 ;; | |
221 -nognu) | |
222 _gnu=no | |
223 ;; | |
23935 | 224 -res) |
225 _res=yes | |
226 ;; | |
227 -nores) | |
228 _res=no | |
229 ;; | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
230 -*) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
231 echo "unknown option: $i" >&2 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
232 exit 0 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
233 ;; |
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 _files="$_files $i" |
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 esac |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
238 done |
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 # ----------------------------------------------------------------------------- |
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 # Set heading color |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
243 |
20204 | 244 if [ "$_color" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
245 COLB="\e[36m" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
246 COLE="\e[m" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
247 else |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
248 COLB="" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
249 COLE="" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
250 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
251 |
19077 | 252 # 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
|
253 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
254 filelist=`all_filenames` |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
255 |
23935 | 256 if [ "$_stupid" = "yes" -o "$_res" = "yes" ] ; then |
257 # generate 'shortlist' to avoid false positives in xpm files, docs, etc, | |
258 # when one only needs to check .c and .h files | |
259 chfilelist=`echo $filelist | tr ' ' '\n' | grep "[\.][ch]$"` | |
260 fi | |
261 | |
20204 | 262 if [ "$_showcont" = "yes" ]; then |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
263 _diffopts="-u" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
264 _grepopts="-n -I" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
265 else |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
266 _diffopts="-q" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
267 _grepopts="-l -I" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
268 fi |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
269 |
23936 | 270 TAB=`echo " " | tr ' ' '\011'` |
271 | |
16240
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 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
274 # DO CHECKS |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
275 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
276 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
277 |
20204 | 278 if [ "$_spaces" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
279 printhead "checking for spaces in filenames ..." |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
280 find . | grep " " |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
281 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
282 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
283 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
284 |
20204 | 285 if [ "$_extensions" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
286 printhead "checking for uppercase extensions ..." |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
287 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
|
288 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
289 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
290 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
291 |
20204 | 292 if [ "$_crlf" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
293 printhead "checking for MSDOS line endings ..." |
19079 | 294 CR=`echo " " | tr ' ' '\015'` |
295 grep $_grepopts "$CR" $filelist | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
296 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
297 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
298 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
299 |
23235 | 300 if [ "$_tabs" = "yes" ]; then |
301 printhead "checking for TAB characters ..." | |
302 grep $_grepopts "$TAB" $filelist | |
303 fi | |
304 | |
305 # ----------------------------------------------------------------------------- | |
306 | |
20204 | 307 if [ "$_trailws" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
308 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
|
309 grep $_grepopts "[[:space:]]\+$" $filelist |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
310 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
311 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
312 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
313 |
20204 | 314 if [ "$_rcsid" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
315 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
|
316 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
|
317 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
318 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
319 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
320 |
20204 | 321 if [ "$_oll" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
322 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
|
323 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
|
324 fi |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
325 |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
326 # ----------------------------------------------------------------------------- |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
327 |
23927 | 328 if [ "$_gnu" = "yes" ]; then |
329 printhead "checking for GNUisms ..." | |
330 grep $_grepopts "case.*\.\.\..*:" $filelist | |
331 fi | |
332 | |
333 # ----------------------------------------------------------------------------- | |
334 | |
23937
00d78036f96b
only test for stupid code and reserved identifiers if there are any .c or .h
ivo
parents:
23936
diff
changeset
|
335 if [ "$_res" = "yes" -a -n "$chfilelist" ]; then |
23935 | 336 printhead "checking for reserved identifiers ..." |
337 grep $_grepopts "#[ $TAB]*define[ $TAB]\+_[[:upper:]].*" $chfilelist | |
338 grep $_grepopts "#[ $TAB]*define[ $TAB]\+__.*" $chfilelist | |
339 fi | |
340 | |
341 # ----------------------------------------------------------------------------- | |
342 | |
20204 | 343 if [ "$_charset" = "yes" ]; then |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
344 printhead "checking bad charsets ..." |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
345 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
|
346 case "$I" in |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
347 ./help/help_mp-*.h) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
348 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
349 ./DOCS/*) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
350 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
351 *.c|*.h) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
352 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
|
353 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
354 esac |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
355 done |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
356 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
357 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
358 # ----------------------------------------------------------------------------- |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
359 |
23937
00d78036f96b
only test for stupid code and reserved identifiers if there are any .c or .h
ivo
parents:
23936
diff
changeset
|
360 if [ "$_stupid" = "yes" -a -n "$chfilelist" ]; then |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
361 printhead "checking for stupid code ..." |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
362 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
363 for i in calloc malloc realloc memalign av_malloc av_mallocz faad_malloc \ |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
364 lzo_malloc safe_malloc mpeg2_malloc _ogg_malloc; do |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
365 printhead "--> casting of void* $i()" |
23939 | 366 grep $_grepopts "([ $TAB]*[a-zA-Z_]\+[ $TAB]*\*.*)[ $TAB]*$i" \ |
367 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
368 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
369 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
370 for i in "" signed unsigned; do |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
371 printhead "--> usage of sizeof($i char)" |
23939 | 372 grep $_grepopts "sizeof[ $TAB]*([ $TAB]*$i[ $TAB]*char[ $TAB]*)" \ |
373 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
374 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
375 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
376 for i in int8_t uint8_t; do |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
377 printhead "--> usage of sizeof($i)" |
23938 | 378 grep $_grepopts "sizeof[ $TAB]*([ $TAB]*$i[ $TAB]*)" $chfilelist |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
379 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
380 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
381 printhead "--> usage of &&1" |
23938 | 382 grep $_grepopts "&&[ $TAB]*1" $chfilelist |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
383 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
384 printhead "--> usage of ||0" |
23938 | 385 grep $_grepopts "||[ $TAB]*0" $chfilelist |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
386 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
387 # added a-fA-F_ to eliminate some false positives |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
388 printhead "--> usage of *0" |
23939 | 389 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*\*[ $TAB]*0[^.0-9xa-fA-F_]" \ |
390 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
391 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
392 printhead "--> usage of *1" |
23939 | 393 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*\*[ $TAB]*1[^.0-9ea-fA-F_]" \ |
394 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
395 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
396 printhead "--> usage of +0" |
23939 | 397 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*+[ $TAB]*0[^.0-9xa-fA-F_]" \ |
398 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
399 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
400 printhead "--> usage of -0" |
23939 | 401 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*-[ $TAB]*0[^.0-9xa-fA-F_]" \ |
402 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
403 fi |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
404 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
405 # ----------------------------------------------------------------------------- |