perl/h2pl/mkvars
John Lightsey 1ae6ead949 Switch most open() calls to three-argument form.
Switch from two-argument form.  Filehandle cloning is still done with the two
argument form for backward compatibility.

Committer:  Get all porting tests to pass.  Increment some $VERSIONs.
Run: ./perl -Ilib regen/mk_invlists.pl; ./perl -Ilib regen/regcharclass.pl

For: RT #130122
2016-12-23 13:52:28 -05:00

32 lines
693 B
Perl

#!/usr/bin/perl
require 'sizeof.ph';
$LIB = '/usr/local/lib/perl';
foreach $include (@ARGV) {
printf STDERR "including %s\n", $include;
do $include;
warn "sourcing $include: $@\n" if ($@);
if (!open (INCLUDE,'<',"$LIB/$include")) {
warn "can't open $LIB/$include: $!\n";
next;
}
while (<INCLUDE>) {
chop;
if (/^\s*eval\s+'sub\s+(\w+)\s.*[^{]$/ || /^\s*sub\s+(\w+)\s.*[^{]$/) {
$var = $1;
$val = eval "&$var;";
if ($@) {
warn "$@: $_";
print <<EOT;
warn "\$$var isn't correctly set" if defined \$_main{'$var'};
EOT
next;
}
( $nval = sprintf ("%x",$val ) ) =~ tr/a-z/A-Z/;
printf "\$%s = 0x%s;\n", $var, $nval;
}
}
}