From: Danilo Almeida Date: Wed, 17 Oct 2001 20:16:31 +0000 (+0000) Subject: Provide a little bit of usage info. More error-checking X-Git-Tag: krb5-1.3-alpha1~1032 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7a89cea18af89801b4beb89badfc01bc2d138bbb;p=krb5.git 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 --- diff --git a/src/util/ChangeLog b/src/util/ChangeLog index 0a0f98df7..948567738 100644 --- a/src/util/ChangeLog +++ b/src/util/ChangeLog @@ -1,3 +1,8 @@ +2001-10-17 Danilo Almeida + + * def-check.pl: Provide a little bit of usage info. More + error-checking. + 2001-10-17 Ken Raeburn * 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 f4d195b35..d74eb7399 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) { - $_ = ; +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->getline(); chop if $len1 < length; goto Cloop1 if /\/\*./; } @@ -66,7 +88,7 @@ while (! eof H) { if (/{/) { $_ .= "\n"; $len1 = length; - $_ .= ; + $_ .= $h->getline(); chop if $len1 < length; goto Struct1; } @@ -74,7 +96,7 @@ while (! eof H) { unless (/;/) { $_ .= "\n"; $len1 = length; - $_ .= ; + $_ .= $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) { - $_ = ; +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";