Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 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 | { |
| 16 | if (/^[a-zA-Z].+[\s*]([A-Za-z_0-9]+)\(.*\)/) |
| 17 | { |
| 18 | $func=$1; |
| 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 | } |
Ralf S. Engelschall | dfeab06 | 1998-12-21 11:00:56 +0000 | [diff] [blame] | 43 | close(IN); |
Ralf S. Engelschall | d02b48c | 1998-12-21 10:52:47 +0000 | [diff] [blame] | 44 | } |
| 45 | |