]>
Commit | Line | Data |
---|---|---|
d02b48c6 RE |
1 | #!/usr/local/bin/perl |
2 | # | |
3 | # This is just a quick script to scan for cases where the 'error' | |
4 | # function name in a XXXerr() macro is wrong. | |
5 | # | |
6 | # Run in the top level by going | |
7 | # perl util/ck_errf.pl */*.c */*/*.c | |
8 | # | |
9 | ||
10 | foreach $file (@ARGV) | |
11 | { | |
12 | open(IN,"<$file") || die "unable to open $file\n"; | |
13 | $func=""; | |
14 | while (<IN>) | |
15 | { | |
aa4ce731 | 16 | if (!/;$/ && /^([a-zA-Z].+[\s*])?([A-Za-z_0-9]+)\(.*[\),]/) |
d02b48c6 | 17 | { |
beb056b3 | 18 | $func=$2; |
d02b48c6 RE |
19 | $func =~ tr/A-Z/a-z/; |
20 | } | |
21 | if (/([A-Z0-9]+)err\(([^,]+)/) | |
22 | { | |
23 | next if ($func eq ""); | |
24 | $errlib=$1; | |
25 | $n=$2; | |
26 | if ($n !~ /([^_]+)_F_(.+)$/) | |
27 | { | |
28 | # print "check -$file:$.:$func:$n\n"; | |
29 | next; | |
30 | } | |
31 | $lib=$1; | |
32 | $n=$2; | |
33 | ||
34 | if ($lib ne $errlib) | |
35 | { print "$file:$.:$func:$n\n"; next; } | |
36 | ||
37 | $n =~ tr/A-Z/a-z/; | |
38 | if (($n ne $func) && ($errlib ne "SYS")) | |
39 | { print "$file:$.:$func:$n\n"; next; } | |
40 | # print "$func:$1\n"; | |
41 | } | |
42 | } | |
dfeab068 | 43 | close(IN); |
d02b48c6 RE |
44 | } |
45 |