From e82f18fab47b698d93971f576f962a3068132912 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Mon, 5 Oct 1998 20:13:17 +0000 Subject: This commit was manufactured by cvs2git to create tag 'SSLeay_0_9_0b'. --- src/lib/libcrypto/err/err_code.pl | 105 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/lib/libcrypto/err/err_code.pl (limited to 'src/lib/libcrypto/err/err_code.pl') diff --git a/src/lib/libcrypto/err/err_code.pl b/src/lib/libcrypto/err/err_code.pl new file mode 100644 index 0000000000..ebc8eef913 --- /dev/null +++ b/src/lib/libcrypto/err/err_code.pl @@ -0,0 +1,105 @@ +#!/usr/bin/perl + +while (@ARGV) + { + $in=shift(@ARGV); + if ($in =~ /^-conf$/) + { + $in=shift(@ARGV); + open(IN,"<$in") || die "unable to open '$in'\n"; + while () + { + s/#.*$//; + s/\s+$//; + next if (/^$/); + if (/^L\s+(\S+)\s+(\S+)$/) + { $errfile{$1}=$2; } + elsif (/^F\s+(\S+)$/) + { $function{$1}=1; } + elsif (/^R\s+(\S+)\s+(\S+)$/) + { $r_value{$1}=$2; } + else { die "bad input line: $in:$.\n"; } + } + close(IN); + next; + } + + open(IN,"<$in") || die "unable to open '$in'\n"; + $last=""; + while () + { + if (/err\(([A-Z0-9]+_F_[0-9A-Z_]+)\s*,\s*([0-9A-Z]+_R_[0-9A-Z_]+)\s*\)/) + { + if ($1 != $last) + { + if ($function{$1} == 0) + { + printf STDERR "$. $1 is bad\n"; + } + } + $function{$1}++; + $last=$1; + $reason{$2}++; + } + } + close(IN); + } + +foreach (keys %function,keys %reason) + { + /^([A-Z0-9]+)_/; + $prefix{$1}++; + } + +@F=sort keys %function; +@R=sort keys %reason; +foreach $j (sort keys %prefix) + { + next if $errfile{$j} eq "NONE"; + printf STDERR "doing %-6s - ",$j; + if (defined($errfile{$j})) + { + open(OUT,">$errfile{$j}") || + die "unable to open '$errfile{$j}':$!\n"; + $close_file=1; + } + else + { + *OUT=*STDOUT; + $close=0; + } + @f=grep(/^${j}_/,@F); + @r=grep(/^${j}_/,@R); + $num=100; + print OUT "/* Error codes for the $j functions. */\n\n"; + print OUT "/* Function codes. */\n"; + $f_count=0; + foreach $i (@f) + { + $z=6-int(length($i)/8); + printf OUT "#define $i%s $num\n","\t" x $z; + $num++; + $f_count++; + } + $num=100; + print OUT "\n/* Reason codes. */\n"; + $r_count=0; + foreach $i (@r) + { + $z=6-int(length($i)/8); + if (defined($r_value{$i})) + { + printf OUT "#define $i%s $r_value{$i}\n","\t" x $z; + } + else + { + printf OUT "#define $i%s $num\n","\t" x $z; + $num++; + } + $r_count++; + } + close(OUT) if $close_file; + + printf STDERR "%3d functions, %3d reasons\n",$f_count,$r_count; + } + -- cgit v1.2.3-55-g6feb