diff options
author | Danilo Almeida <dalmeida@mit.edu> | 2001-10-17 20:16:31 +0000 |
---|---|---|
committer | Danilo Almeida <dalmeida@mit.edu> | 2001-10-17 20:16:31 +0000 |
commit | 7a89cea18af89801b4beb89badfc01bc2d138bbb (patch) | |
tree | ad9dfcf3162dbcd19129d1387d3e817e9fd7c108 /src/util | |
parent | bd65e8bba8654e2d5e65051388bdf4b22ad04ddd (diff) | |
download | krb5-7a89cea18af89801b4beb89badfc01bc2d138bbb.tar.gz krb5-7a89cea18af89801b4beb89badfc01bc2d138bbb.tar.xz krb5-7a89cea18af89801b4beb89badfc01bc2d138bbb.zip |
Provide a little bit of usage info. More error-checking
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13815 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/ChangeLog | 5 | ||||
-rw-r--r-- | src/util/def-check.pl | 56 |
2 files changed, 45 insertions, 16 deletions
diff --git a/src/util/ChangeLog b/src/util/ChangeLog index 0a0f98df7f..9485677383 100644 --- a/src/util/ChangeLog +++ b/src/util/ChangeLog @@ -1,3 +1,8 @@ +2001-10-17 Danilo Almeida <dalmeida@mit.edu> + + * def-check.pl: Provide a little bit of usage info. More + error-checking. + 2001-10-17 Ken Raeburn <raeburn@mit.edu> * def-check.pl: New file. Not currently used by any automatic diff --git a/src/util/def-check.pl b/src/util/def-check.pl index f4d195b35d..d74eb73998 100644 --- a/src/util/def-check.pl +++ b/src/util/def-check.pl @@ -1,17 +1,39 @@ -#!/usr/athena/bin/perl +#!/usr/athena/bin/perl -w + +# Code initially generated by s2p +# Code modified to use strict and IO::File + eval 'exec /usr/athena/bin/perl -S $0 ${1+"$@"}' - if $running_under_some_shell; + if 0; # line above evaluated when running under some shell (i.e., not perl) + +use strict; +use IO::File; + +my $h_filename = shift @ARGV || die "usage: $0 header-file [def-file]\n"; +my $d_filename = shift @ARGV; -@convC = (); -@convK = (); -@convD = (); +my $h = open_always($h_filename); +my $d = open_always($d_filename); -open H, "<$ARGV[0]" || die "aaaa! $!"; -open D, "<$ARGV[1]"; +sub open_always +{ + my $file = shift || die; + my $handle = new IO::File "<$file"; + die "Could not open $file\n" if !$handle; + return $handle; +} + +my @convC = (); +my @convK = (); +my @convD = (); + +my $len1; +my %conv; +my $printit; LINE: -while (! eof H) { - $_ = <H>; +while (! $h->eof()) { + $_ = $h->getline(); chop; # get calling convention info for function decls # what about function pointer typedefs? @@ -45,7 +67,7 @@ while (! eof H) { if (/\/\*$/) { $_ .= "\n"; $len1 = length; - $_ .= <H>; + $_ .= $h->getline(); chop if $len1 < length; goto Cloop1 if /\/\*./; } @@ -66,7 +88,7 @@ while (! eof H) { if (/{/) { $_ .= "\n"; $len1 = length; - $_ .= <H>; + $_ .= $h->getline(); chop if $len1 < length; goto Struct1; } @@ -74,7 +96,7 @@ while (! eof H) { unless (/;/) { $_ .= "\n"; $len1 = length; - $_ .= <H>; + $_ .= $h->getline(); chop if $len1 < length; s/\n/ /g; s/[ \t]+/ /g; @@ -114,7 +136,7 @@ while (! eof H) { s/^.*KRB5_CALLCONV *//; push @convK, $_; } else { - die horribly; + die; } goto Hadcallc; } @@ -143,9 +165,11 @@ map { $conv{$_} = "default"; } @convD; map { $conv{$_} = "KRB5"; } @convK; map { $conv{$_} = "KRB5_C"; } @convC; +exit if !$d; + LINE2: -while (! eof D) { - $_ = <D>; +while (! $d->eof()) { + $_ = $d->getline(); chop; # if (/^;/) { @@ -170,7 +194,7 @@ while (! eof D) { s/;.*$//; if (!defined($conv{$_})) { print "No calling convention specified for $_!\n"; - } elsif ($conv{$_} != $xconv) { + } elsif (! ($conv{$_} eq $xconv)) { print "Function $_ should have calling convention '$xconv', but has '$conv{$_}' instead.\n"; } else { # print "Function $_ is okay.\n"; |