There's no rest for the wicked misspellers.
[p5sagit/p5-mst-13.2.git] / reentr.pl
index 6b1f21c..5494f78 100644 (file)
--- a/reentr.pl
+++ b/reentr.pl
@@ -169,7 +169,15 @@ while (<DATA>) {
        $prereqh  = "$h.h";
        $prereqsh = "\$$prereqs $prereqh";
     }
-    print <<EOF if $opts{U};
+    if ($opts{U}) {
+       my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
+       push @prereq, $prereqs;
+        my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
+        if ($h eq 'time') {
+           $hdrs .= " \$i_systime sys/time.h";
+           push @prereq, 'i_systime';
+       }
+       print <<EOF;
 ?RCS: \$Id: d_${f}_r.U,v $
 ?RCS:
 ?RCS: Copyright (c) 2002 Jarkko Hietaniemi
@@ -179,7 +187,7 @@ while (<DATA>) {
 ?RCS:
 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
 ?RCS:
-?MAKE:d_${f}_r ${f}_r_proto: Inlibc Protochk Hasproto i_systypes i_systime $prereqs usethreads i_pthread
+?MAKE:d_${f}_r ${f}_r_proto: @prereq
 ?MAKE: -pick add \$@ %<
 ?S:d_${f}_r:
 ?S:    This variable conditionally defines the HAS_${F}_R symbol,
@@ -207,12 +215,9 @@ set ${f}_r d_${f}_r
 eval \$inlibc
 case "\$d_${f}_r" in
 "\$define")
-       hdrs="\$i_systypes sys/types.h define stdio.h $prereqsh"
-       case "$h" in
-       time)
-               hdrs="\$hdrs \$i_systime sys/time.h"
-               ;;
-       esac
+EOF
+       print <<EOF;
+       hdrs="$hdrs"
        case "\$d_${f}_r_proto:\$usethreads" in
        ":define")      d_${f}_r_proto=define
                set d_${f}_r_proto ${f}_r \$hdrs
@@ -222,26 +227,27 @@ case "\$d_${f}_r" in
        case "\$d_${f}_r_proto" in
        define)
 EOF
-       for my $p (@p) {
-           my ($r, $a) = ($p =~ /^(.)_(.+)/);
-           my $v = join(", ", map { $m{$_} } split '', $a);
-           if ($opts{U}) {
-               print <<EOF ;
+    }
+    for my $p (@p) {
+        my ($r, $a) = ($p =~ /^(.)_(.+)/);
+       my $v = join(", ", map { $m{$_} } split '', $a);
+       if ($opts{U}) {
+           print <<EOF ;
        case "\$${f}_r_proto" in
        ''|0) try='$m{$r} ${f}_r($v);'
        ./protochk "extern \$try" \$hdrs && ${f}_r_proto=$p ;;
        esac
 EOF
-            }
-           $seenh{$f}->{$p}++;
-           push @{$seena{$f}}, $p;
-           $seenp{$p}++;
-           $seent{$f} = $t;
-           $seens{$f} = $m{S};
-           $seend{$f} = $m{D};
-       }
-       if ($opts{U}) {
-           print <<EOF;
+        }
+        $seenh{$f}->{$p}++;
+        push @{$seena{$f}}, $p;
+        $seenp{$p}++;
+        $seent{$f} = $t;
+        $seens{$f} = $m{S};
+        $seend{$f} = $m{D};
+    }
+    if ($opts{U}) {
+       print <<EOF;
        case "\$${f}_r_proto" in
        ''|0)   d_${f}_r=undef
                ${f}_r_proto=0