]> git.ipfire.org Git - thirdparty/openssl.git/blob - util/ck_errf.pl
Import of old SSLeay release: SSLeay 0.8.1b
[thirdparty/openssl.git] / util / ck_errf.pl
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 }
43 }
44