: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
: Protect any dollar signs and backticks that you do not want interpreted
: by putting a backslash in front. You may delete these comments.
+rm -f h2ph
$spitshell >h2ph <<!GROK!THIS!
-#!$bin/perl
-'di';
-'ig00';
+#!$binexp/perl
+'di ';
+'ds 00 \"';
+'ig 00 ';
-\$perlincl = '$privlib';
+\$perlincl = '$archlibexp';
!GROK!THIS!
: In the following dollars and backticks do not need the extra backslash.
FILE
END
-$isatype{@isatype} = (1) x @isatype;
+@isatype{@isatype} = (1) x @isatype;
+$inif = 0;
@ARGV = ('-') unless @ARGV;
$args = $1;
if ($args ne '') {
foreach $arg (split(/,\s*/,$args)) {
+ $arg =~ s/^\s*([^\s].*[^\s])\s*$/$1/;
$curargs{$arg} = 1;
}
$args =~ s/\b(\w)/\$$1/g;
}
}
}
- elsif (/^include <(.*)>/) {
+ elsif (/^include\s+<(.*)>/) {
($incl = $1) =~ s/\.h$/.ph/;
print OUT $t,"require '$incl';\n";
}
}
elsif (s/^if\s+//) {
$new = '';
+ $inif = 1;
do expr();
+ $inif = 0;
print OUT $t,"if ($new) {\n";
$tab += 4;
$t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
}
elsif (s/^elif\s+//) {
$new = '';
+ $inif = 1;
do expr();
+ $inif = 0;
$tab -= 4;
$t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
print OUT $t,"}\n${t}elsif ($new) {\n";
}
}
else {
- $new .= ' &' . $id;
+ if ($inif && $new !~ /defined\($/) {
+ $new .= '(defined(&' . $id . ') ? &' . $id . ' : 0)';
+ } else {
+ $new .= ' &' . $id;
+ }
}
next;
};
# These next few lines are legal in both Perl and nroff.
-.00; # finish .ig
-
+.00 ; # finish .ig
+
'di \" finish diversion--previous line must be blank
.nr nl 0-1 \" fake up transition to first page again
.nr % 0 \" start at page 1