annotate TOOLS/checktree.sh @ 17981:368ad4d775be

synced with 1.1249
author gpoirier
date Mon, 27 Mar 2006 19:43:46 +0000
parents 80d3fdcf58a8
children edffd6f8a022
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
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
25 _showcont=no
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
26
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
27 _color=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
28 _head=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
29 _cvs=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
30 _files=
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 # -----------------------------------------------------------------------------
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 # Avoid locale problems
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
35
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
36 export LC_ALL=C
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
40 # Helper functions
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 enable_all_tests() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
43 _spaces=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
44 _extensions=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
45 _crlf=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
46 _trailws=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
47 _rcsid=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
48 _oll=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
49 }
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 disable_all_tests() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
52 _spaces=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
53 _extensions=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
54 _crlf=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
55 _trailws=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
56 _rcsid=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
57 _oll=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
58 }
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 printoption() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
61 echo " -(no)$1 $2 [default: $3]"
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
64 printhead() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
65 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
66 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
67
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
68 all_filenames() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
69 test "$_files" != "" && echo "$_files" && return
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 if [ "$_cvs" == "no" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
72 find . -type f \
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
73 | 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
74 | grep -v "^\./version\.h\|\.o$\|\.a$"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
75 else
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
76 list_cvs .
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
77 fi
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
80 list_cvs() {
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
81 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
82 echo $1/$i
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
83 done
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
84 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
85 list_cvs $1/$j
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 }
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
88
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
89 # -----------------------------------------------------------------------------
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 # Parse command line
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 for i in "$@"; do
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
94 case "$i" in
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
95 -help)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
96 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
97 echo -e "options:\n"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
98 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
99 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
100 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
101 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
102 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
103 printoption "oll " "test for overly long lines" "$_oll"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
104 echo
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
105 printoption "all " "enable all tests" "no"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
106 echo
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
107 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
108 "$_showcont"
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
109 echo
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
110 printoption "color " "colored output" "$_color"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
111 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
112 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
113 "$_cvs"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
114 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
115 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
116 exit
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
117 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
118 -oll)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
119 _oll=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
120 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
121 -nooll)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
122 _oll=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
123 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
124 -cvs)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
125 _cvs=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
126 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
127 -nocvs)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
128 _cvs=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
129 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
130 -head)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
131 _head=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
132 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
133 -nohead)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
134 _head=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
135 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
136 -color)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
137 _color=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
138 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
139 -nocolor)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
140 _color=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
141 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
142 -spaces)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
143 _spaces=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
144 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
145 -nospaces)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
146 _spaces=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
147 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
148 -extensions)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
149 _extensions=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
150 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
151 -noextensions)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
152 _extensions=no
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 -crlf)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
155 _crlf=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
156 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
157 -nocrlf)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
158 _crlf=no
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 -trailws)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
161 _trailws=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
162 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
163 -notrailws)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
164 _trailws=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
165 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
166 -rcsid)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
167 _rcsid=yes
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
168 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
169 -norcsid)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
170 _rcsid=no
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
171 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
172 -all)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
173 enable_all_tests
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
174 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
175 -noall)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
176 disable_all_tests
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
177 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
178 -none)
16405
ivo
parents: 16240
diff changeset
179 disable_all_tests
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
180 ;;
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
181 -showcont)
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
182 _showcont=yes
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
183 ;;
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
184 -noshowcont)
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
185 _showcont=no
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
186 ;;
16240
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 echo "unknown option: $i" >&2
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
189 exit 0
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
190 ;;
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
191 *)
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
192 _files="$_files $i"
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 esac
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
195 done
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 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
198
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
199 # Set heading color
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 if [ "$_color" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
202 COLB="\e[36m"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
203 COLE="\e[m"
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
204 else
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
205 COLB=""
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
206 COLE=""
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
207 fi
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 # 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
210
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
211 filelist=`all_filenames`
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
212
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
213 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
214
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
215 # DO CHECKS
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
216
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 if [ "$_spaces" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
220 printhead "checking for spaces in filenames ..."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
221 find . | grep " "
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
222 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
223
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
224 # -----------------------------------------------------------------------------
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 if [ "$_extensions" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
227 printhead "checking for uppercase extensions ..."
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
228 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
229 fi
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 # -----------------------------------------------------------------------------
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 if [ "$_crlf" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
234 printhead "checking for MSDOS line endings ..."
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
235 if [ "$_showcont" == "yes" ]; then
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
236 grep -n -I "
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
237 " $filelist
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
238 else
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
239 grep -l -I "
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
240 " $filelist
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
241 fi
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
242 fi
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 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
245
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
246 if [ "$_trailws" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
247 printhead "checking for trailing whitespace ..."
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
248 if [ "$_showcont" == "yes" ]; then
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
249 grep -n -I "[[:space:]]\+$" $filelist
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
250 else
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
251 grep -l -I "[[:space:]]\+$" $filelist
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
252 fi
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
253 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
254
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
255 # -----------------------------------------------------------------------------
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
256
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
257 if [ "$_rcsid" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
258 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
259 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
260 fi
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
261
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
262 # -----------------------------------------------------------------------------
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 if [ "$_oll" == "yes" ]; then
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
265 printhead "checking for overly long lines (over 79 characters) ..."
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
266 if [ "$_showcont" == "yes" ]; then
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
267 grep -n -I "^[[:print:]]\{80,\}$" $filelist
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
268 else
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
269 grep -l -I "^[[:print:]]\{80,\}$" $filelist
17131
80d3fdcf58a8 option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents: 16405
diff changeset
270 fi
16240
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
271 fi
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
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
275 # End
d4cf25d45b13 Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff changeset
276