diff options
author | ugen <ugen@FreeBSD.org> | 1995-02-03 15:16:03 +0000 |
---|---|---|
committer | ugen <ugen@FreeBSD.org> | 1995-02-03 15:16:03 +0000 |
commit | 216e2af04b838e3312c38eeb7b50834742b16865 (patch) | |
tree | 6eef6a11f1a487b839dcc7053f670435f9d8d172 /gnu/usr.bin/perl | |
parent | 2eeae6e888aa41690bf18fe7cb34dadbb5832ccc (diff) | |
download | FreeBSD-src-216e2af04b838e3312c38eeb7b50834742b16865.zip FreeBSD-src-216e2af04b838e3312c38eeb7b50834742b16865.tar.gz |
Fix to h2ph "undefined function" bug
i reported today earlier..tested and works OK..
( To those who want to experience bug try running aub
with old version of socket.ph and with new one or just any
perl script "requiring " <sys/socket.ph> or <sys/cdefs.ph> )
Diffstat (limited to 'gnu/usr.bin/perl')
-rwxr-xr-x | gnu/usr.bin/perl/x2p/h2ph | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gnu/usr.bin/perl/x2p/h2ph b/gnu/usr.bin/perl/x2p/h2ph index 26c4ec4..143791f 100755 --- a/gnu/usr.bin/perl/x2p/h2ph +++ b/gnu/usr.bin/perl/x2p/h2ph @@ -68,7 +68,7 @@ foreach $file (@ARGV) { $args = "local($args) = \@_;\n$t "; } s/^\s+//; - do expr(); + do expr(0); $new =~ s/(["\\])/\\$1/g; if ($t ne '') { $new =~ s/(['\\])/\\$1/g; @@ -82,7 +82,7 @@ foreach $file (@ARGV) { } else { s/^\s+//; - do expr(); + do expr(0); $new = 1 if $new eq ''; if ($t ne '') { $new =~ s/(['\\])/\\$1/g; @@ -109,14 +109,14 @@ foreach $file (@ARGV) { } elsif (s/^if\s+//) { $new = ''; - do expr(); - print OUT $t,"if ($new) {\n"; + do expr(1); + print OUT $t,"if ( $new) {\n"; $tab += 4; $t = "\t" x ($tab / 8) . ' ' x ($tab % 8); } elsif (s/^elif\s+//) { $new = ''; - do expr(); + do expr(1); $tab -= 4; $t = "\t" x ($tab / 8) . ' ' x ($tab % 8); print OUT $t,"}\n${t}elsif ($new) {\n"; @@ -141,6 +141,7 @@ foreach $file (@ARGV) { } sub expr { +$hd=0; while ($_ ne '') { s/^(\s+)// && do {$new .= ' '; next;}; s/^(0x[0-9a-fA-F]+)// && do {$new .= $1; next;}; @@ -176,6 +177,7 @@ sub expr { } elsif ($id eq 'defined') { $new .= 'defined'; + $hd=1; } elsif (/^\(/) { s/^\((\w),/("$1",/ if $id =~ /^_IO[WR]*$/i; # cheat @@ -184,6 +186,7 @@ sub expr { elsif ($isatype{$id}) { if ($new =~ /{\s*$/) { $new .= "'$id'"; + $hd=0; } elsif ($new =~ /\(\s*$/ && /^[\s*]*\)/) { $new =~ s/\(\s*$//; @@ -194,7 +197,12 @@ sub expr { } } else { - $new .= ' &' . $id; + if ($hd == 0) { + $new .= 'defined &' . $id . ' && &' . $id; + } else { + $new .= ' &' . $id; + } + $hd=0; } next; }; |