Mercurial > mplayer.hg
annotate TOOLS/checktree.sh @ 34634:0ef7177a063b
Fix linking after FFmpeg merge.
Protocols that are available only when librtmp is present
are no longer disabled in the code, so we have to remove
them in our configure.
author | iive |
---|---|
date | Tue, 14 Feb 2012 16:50:42 +0000 |
parents | 92d75e703bc0 |
children |
rev | line source |
---|---|
27199 | 1 #!/bin/bash |
16240
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 # |
23940 | 7 # Copyright (C) 2005-2007 by Ivo van Poorten |
8 # | |
9 # This program is free software; you can redistribute it and/or modify | |
10 # it under the terms of the GNU General Public License as published by | |
11 # the Free Software Foundation; either version 2 of the License, or | |
12 # (at your option) any later version. | |
13 # | |
14 # This program is distributed in the hope that it will be useful, | |
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 # GNU General Public License for more details. | |
18 # | |
19 # You should have received a copy of the GNU General Public License | |
20 # along with this program; if not, write to the Free Software | |
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
22 # |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
23 # 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
|
24 # 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
|
25 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
26 # $Id$ |
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 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
29 |
23948 | 30 # All yes/no flags. Spaces around flagnames are important! |
31 | |
32 testflags=" spaces extensions crlf tabs trailws rcsid oll charset stupid gnu \ | |
25192
1291178302e2
10l for me. I should read my own comments just above it ;)
ivo
parents:
25191
diff
changeset
|
33 res depr " |
23948 | 34 allflags="$testflags showcont color head svn " |
35 | |
16240
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 # Avoid locale problems |
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 export LC_ALL=C |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
41 |
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 # Helper functions |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
45 |
23949 | 46 set_all_tests() { |
47 for i in $testflags ; do | |
48 eval _$i=$1 | |
49 done | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
50 } |
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 printoption() { |
23951
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
53 test -n "$3" && def=$3 || eval def=\$_$1 |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
54 echo " -(no)$1 $2 [default: $def]" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
55 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
56 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
57 printhead() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
58 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
|
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 all_filenames() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
62 test "$_files" != "" && echo "$_files" && return |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
63 |
20204 | 64 if [ "$_svn" = "no" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
65 find . -type f \ |
19077 | 66 | grep -v "\.\#\|\~$\|\.depend\|\/\.svn\/\|config.mak\|^\./config\.h" \ |
31349
92d75e703bc0
Rename configure.log file to the more standard name config.log.
diego
parents:
27199
diff
changeset
|
67 | grep -v "^\./version\.h\|\.o$\|\.a$\|config.log\|^\./help_mp.h" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
68 else |
25277
89458daaee5f
when gathering the list of files to check via svn info, also include
ivo
parents:
25261
diff
changeset
|
69 for p in . libavcodec libavutil libavformat libpostproc ; do |
25284
e60a367eb80e
suppress silly messages when checktree is not called from the root of the tree
ivo
parents:
25283
diff
changeset
|
70 svn info -R $p 2>/dev/null | sed -n \ |
25261 | 71 '/Path:/bb; :a; d; b; :b; s/Path: /.\//; h; :c; n; |
72 /Node Kind:/bd; bc; :d; /directory/ba; g; p;' | |
25260
601f3c36dc9e
when gathering the list of files to check via svn info, also include
ivo
parents:
25259
diff
changeset
|
73 done |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
74 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
75 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
76 |
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 |
25191 | 79 # Default settings |
80 | |
81 set_all_tests no | |
82 _spaces=yes | |
83 _extensions=yes | |
84 _crlf=yes | |
85 | |
86 _showcont=no | |
87 _color=yes | |
88 _head=yes | |
89 _svn=yes | |
90 _files= | |
91 | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
92 # Parse command line |
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 for i in "$@"; do |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
95 case "$i" in |
22359
206b4600a956
also respond to --help, -h and -? command line options
ivo
parents:
22358
diff
changeset
|
96 -help|--help|-h|-\?) |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
97 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
|
98 echo -e "options:\n" |
23951
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
99 printoption "spaces " "test for spaces in filenames" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
100 printoption "extensions" "test for uppercase extensions" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
101 printoption "crlf " "test for MSDOS line endings" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
102 printoption "tabs " "test for tab characters" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
103 printoption "trailws " "test for trailing whitespace" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
104 printoption "rcsid " "test for missing RCS Id's" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
105 printoption "oll " "test for overly long lines" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
106 printoption "charset " "test for wrong charset" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
107 printoption "stupid " "test for stupid code" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
108 printoption "gnu " "test for GNUisms" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
109 printoption "res " "test for reserved identifiers" |
25190 | 110 printoption "depr " "test for deprecated function calls" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
111 echo |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
112 printoption "all " "enable all tests" "no" |
22357 | 113 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
|
114 echo |
23951
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
115 printoption "showcont " "show offending content of file(s)" |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
116 echo |
23951
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
117 printoption "color " "colored output" |
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
118 printoption "head " "print heading for each test" |
22509 | 119 printoption "svn " \ |
23951
993062afb229
Make the printoption function take the default values from the variable
ivo
parents:
23950
diff
changeset
|
120 "use svn info to determine which files to check" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
121 echo -e "\nIf no files are specified, the whole tree is traversed." |
19077 | 122 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
|
123 exit |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
124 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
125 -all) |
23949 | 126 set_all_tests yes |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
127 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
128 -noall) |
23949 | 129 set_all_tests no |
16240
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 -none) |
23949 | 132 set_all_tests no |
16240
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 -*) |
23948 | 135 var=`echo X$i | sed 's/^X-//'` |
136 val=yes | |
137 case "$var" in | |
138 no*) | |
139 var=`echo "$var" | cut -c 3-` | |
140 val=no | |
141 ;; | |
142 esac | |
143 case "$allflags" in | |
144 *\ $var\ *) | |
145 eval _$var=$val | |
146 ;; | |
147 *) | |
23950 | 148 echo "unknown option: $i" >&2 |
149 exit 0 | |
150 ;; | |
23948 | 151 esac |
152 ;; | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
153 *) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
154 _files="$_files $i" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
155 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
156 esac |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
157 done |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
158 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
159 # ----------------------------------------------------------------------------- |
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 # Set heading color |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
162 |
20204 | 163 if [ "$_color" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
164 COLB="\e[36m" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
165 COLE="\e[m" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
166 else |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
167 COLB="" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
168 COLE="" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
169 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
170 |
25281
cf9a7a933032
test for presence of .svn directory if we are supposed to traverse the tree
ivo
parents:
25277
diff
changeset
|
171 # Test presence of svn info |
cf9a7a933032
test for presence of .svn directory if we are supposed to traverse the tree
ivo
parents:
25277
diff
changeset
|
172 |
cf9a7a933032
test for presence of .svn directory if we are supposed to traverse the tree
ivo
parents:
25277
diff
changeset
|
173 if [ "$_svn" = "yes" -a ! -d .svn ] ; then |
cf9a7a933032
test for presence of .svn directory if we are supposed to traverse the tree
ivo
parents:
25277
diff
changeset
|
174 echo "No svn info available. Please use -nosvn." >&2 |
cf9a7a933032
test for presence of .svn directory if we are supposed to traverse the tree
ivo
parents:
25277
diff
changeset
|
175 exit 1 |
cf9a7a933032
test for presence of .svn directory if we are supposed to traverse the tree
ivo
parents:
25277
diff
changeset
|
176 fi |
cf9a7a933032
test for presence of .svn directory if we are supposed to traverse the tree
ivo
parents:
25277
diff
changeset
|
177 |
19077 | 178 # 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
|
179 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
180 filelist=`all_filenames` |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
181 |
25283 | 182 case "$_stupid$_res$_depr$_gnu" in |
25282
5ed3c0a5cf4f
simpler and more easily expandable test whether we need a shortlist that
ivo
parents:
25281
diff
changeset
|
183 *yes*) |
23935 | 184 # generate 'shortlist' to avoid false positives in xpm files, docs, etc, |
185 # when one only needs to check .c and .h files | |
186 chfilelist=`echo $filelist | tr ' ' '\n' | grep "[\.][ch]$"` | |
25282
5ed3c0a5cf4f
simpler and more easily expandable test whether we need a shortlist that
ivo
parents:
25281
diff
changeset
|
187 ;; |
5ed3c0a5cf4f
simpler and more easily expandable test whether we need a shortlist that
ivo
parents:
25281
diff
changeset
|
188 esac |
23935 | 189 |
20204 | 190 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
|
191 _diffopts="-u" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
192 _grepopts="-n -I" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
193 else |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
194 _diffopts="-q" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
195 _grepopts="-l -I" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
196 fi |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
197 |
23936 | 198 TAB=`echo " " | tr ' ' '\011'` |
199 | |
16240
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 # DO CHECKS |
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 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
205 |
20204 | 206 if [ "$_spaces" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
207 printhead "checking for spaces in filenames ..." |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
208 find . | grep " " |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
209 fi |
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 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
212 |
20204 | 213 if [ "$_extensions" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
214 printhead "checking for uppercase extensions ..." |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
215 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
|
216 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
217 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
218 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
219 |
20204 | 220 if [ "$_crlf" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
221 printhead "checking for MSDOS line endings ..." |
19079 | 222 CR=`echo " " | tr ' ' '\015'` |
223 grep $_grepopts "$CR" $filelist | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
224 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
225 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
226 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
227 |
23235 | 228 if [ "$_tabs" = "yes" ]; then |
229 printhead "checking for TAB characters ..." | |
230 grep $_grepopts "$TAB" $filelist | |
231 fi | |
232 | |
233 # ----------------------------------------------------------------------------- | |
234 | |
20204 | 235 if [ "$_trailws" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
236 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
|
237 grep $_grepopts "[[:space:]]\+$" $filelist |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
238 fi |
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 |
20204 | 242 if [ "$_rcsid" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
243 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
|
244 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
|
245 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
246 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
247 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
248 |
20204 | 249 if [ "$_oll" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
250 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
|
251 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
|
252 fi |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
253 |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
254 # ----------------------------------------------------------------------------- |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
255 |
25283 | 256 if [ "$_gnu" = "yes" -a -n "$chfilelist" ]; then |
23927 | 257 printhead "checking for GNUisms ..." |
25283 | 258 grep $_grepopts "case.*\.\.\..*:" $chfilelist |
23927 | 259 fi |
260 | |
261 # ----------------------------------------------------------------------------- | |
262 | |
23937
00d78036f96b
only test for stupid code and reserved identifiers if there are any .c or .h
ivo
parents:
23936
diff
changeset
|
263 if [ "$_res" = "yes" -a -n "$chfilelist" ]; then |
23935 | 264 printhead "checking for reserved identifiers ..." |
265 grep $_grepopts "#[ $TAB]*define[ $TAB]\+_[[:upper:]].*" $chfilelist | |
266 grep $_grepopts "#[ $TAB]*define[ $TAB]\+__.*" $chfilelist | |
267 fi | |
268 | |
269 # ----------------------------------------------------------------------------- | |
270 | |
20204 | 271 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
|
272 printhead "checking bad charsets ..." |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
273 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
|
274 case "$I" in |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
275 ./help/help_mp-*.h) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
276 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
277 ./DOCS/*) |
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 *.c|*.h) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
280 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
|
281 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
282 esac |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
283 done |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
284 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
285 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
286 # ----------------------------------------------------------------------------- |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
287 |
23937
00d78036f96b
only test for stupid code and reserved identifiers if there are any .c or .h
ivo
parents:
23936
diff
changeset
|
288 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
|
289 printhead "checking for stupid code ..." |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
290 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
291 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
|
292 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
|
293 printhead "--> casting of void* $i()" |
23939 | 294 grep $_grepopts "([ $TAB]*[a-zA-Z_]\+[ $TAB]*\*.*)[ $TAB]*$i" \ |
295 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
296 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
297 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
298 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
|
299 printhead "--> usage of sizeof($i char)" |
23939 | 300 grep $_grepopts "sizeof[ $TAB]*([ $TAB]*$i[ $TAB]*char[ $TAB]*)" \ |
301 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
302 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
303 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
304 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
|
305 printhead "--> usage of sizeof($i)" |
23938 | 306 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
|
307 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
308 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
309 printhead "--> usage of &&1" |
23938 | 310 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
|
311 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
312 printhead "--> usage of ||0" |
23938 | 313 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
|
314 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
315 # 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
|
316 printhead "--> usage of *0" |
23939 | 317 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*\*[ $TAB]*0[^.0-9xa-fA-F_]" \ |
318 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
319 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
320 printhead "--> usage of *1" |
23939 | 321 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*\*[ $TAB]*1[^.0-9ea-fA-F_]" \ |
322 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
323 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
324 printhead "--> usage of +0" |
23939 | 325 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*+[ $TAB]*0[^.0-9xa-fA-F_]" \ |
326 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
327 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
328 printhead "--> usage of -0" |
23939 | 329 grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*-[ $TAB]*0[^.0-9xa-fA-F_]" \ |
330 $chfilelist | |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
331 fi |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
332 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
333 # ----------------------------------------------------------------------------- |
25190 | 334 |
335 if [ "$_depr" = "yes" -a -n "$chfilelist" ]; then | |
336 printhead "checking for deprecated and obsolete function calls ..." | |
337 | |
338 for i in bcmp bcopy bzero getcwd getipnodebyname inet_ntoa inet_addr \ | |
339 atoq ecvt fcvt ecvt_r fcvt_r qecvt_r qfcvt_r finite ftime gcvt herror \ | |
340 hstrerror getpass getpw getutent getutid getutline pututline setutent \ | |
341 endutent utmpname gsignal ssignal gsignal_r ssignal_r infnan memalign \ | |
342 valloc re_comp re_exec drem dremf dreml rexec svc_getreq sigset \ | |
343 sighold sigrelse sigignore sigvec sigmask sigblock sigsetmask \ | |
344 siggetmask ualarm ulimit usleep statfs fstatfs ustat get_kernel_syms \ | |
25259
91cb6c6ec0c2
add functions that are not specifically marked as being deprecated or obsolete,
ivo
parents:
25192
diff
changeset
|
345 query_module sbrk tempnam tmpnam mktemp mkstemp |
25190 | 346 do |
347 printhead "--> $i()" | |
348 grep $_grepopts "[^a-zA-Z0-9]$i[ $TAB]*(" $chfilelist | |
349 done | |
350 fi |