diff options
author | Benjamin Stuhl <sho_pi@hotmail.com> | 1999-11-18 10:45:27 -0800 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-05 11:07:37 +0000 |
commit | 7a958ec31151f9d03a26dcab8abdf5c57315dc96 (patch) | |
tree | bf0c1582733a01b04dc1e389cf32286fba918631 /win32/config_sh.PL | |
parent | 878143fbd9fc1c2bef489be4fd428b8d222cc108 (diff) | |
download | perl-7a958ec31151f9d03a26dcab8abdf5c57315dc96.tar.gz |
applied somewhat modified version of suggested patch
Message-ID: <19991119024527.72749.qmail@hotmail.com>
Subject: [PATCH 5.005_62] Perl on Win95, Mark IIB
p4raw-id: //depot/perl@4653
Diffstat (limited to 'win32/config_sh.PL')
-rw-r--r-- | win32/config_sh.PL | 71 |
1 files changed, 47 insertions, 24 deletions
diff --git a/win32/config_sh.PL b/win32/config_sh.PL index 9e53b54827..b1c7b9f592 100644 --- a/win32/config_sh.PL +++ b/win32/config_sh.PL @@ -10,12 +10,35 @@ sub mungepath { return join(' ', @p); } +# generate an array of option strings from command-line args +# or an option file +# -- added by BKS, 10-17-1999 to fix command-line overflow problems +sub loadopts { + if ($ARGV[0] =~ /--cfgsh-option-file/) { + shift @ARGV; + my $optfile = shift @ARGV; + local (*F); + open OPTF, $optfile or die "Can't open $optfile: $!\n"; + my @opts; + chomp(my $line = <OPTF>); + my @vars = split(/\t+~\t+/, $line); + for (@vars) { + push(@opts, $_) unless (/^\s*$/); + } + close OPTF; + return \@opts; + } + else { + return \@ARGV; + } +} + my %opt; -while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/) - { - $opt{$1}=$2; - shift(@ARGV); - } +my $optref = loadopts(); +while (@{$optref} && $optref->[0] =~ /^([\w_]+)=(.*)$/) { + $opt{$1}=$2; + shift(@{$optref}); +} my $pl_h = '../patchlevel.h'; @@ -31,13 +54,13 @@ if (-e $pl_h) { close PL; } elsif ($] =~ /^(\d+)\.(\d\d\d)?(\d\d)?$/) { # should always be true - $opt{PERL_REVISION} = $1; - $opt{PERL_VERSION} = int($2 || 0); - $opt{PERL_SUBVERSION} = $3; - $opt{PERL_APIVERSION} = $]; + $opt{PERL_REVISION} = $1; + $opt{PERL_VERSION} = int($2 || 0); + $opt{PERL_SUBVERSION} = $3; + $opt{PERL_APIVERSION} = $]; } else { - die "Can't parse perl version ($])"; + die "Can't parse perl version ($])"; } $opt{PERL_SUBVERSION} ||= '00'; @@ -50,19 +73,19 @@ $opt{'usemymalloc'} = 'y' if $opt{'d_mymalloc'} eq 'define'; $opt{libpth} = mungepath($opt{libpth}) if exists $opt{libpth}; $opt{incpath} = mungepath($opt{incpath}) if exists $opt{incpath}; -while (<>) - { - s/~([\w_]+)~/$opt{$1}/g; - if (/^([\w_]+)=(.*)$/) { - my($k,$v) = ($1,$2); - # this depends on cf_time being empty in the template (or we'll get a loop) - if ($k eq 'cf_time') { - $_ = "$k='" . localtime(time) . "'\n" if $v =~ /^\s*'\s*'/; - } - elsif (exists $opt{$k}) { - $_ = "$k='$opt{$k}'\n"; +while (<>) { + s/~([\w_]+)~/$opt{$1}/g; + if (/^([\w_]+)=(.*)$/) { + my($k,$v) = ($1,$2); + # this depends on cf_time being empty in the template (or we'll + # get a loop) + if ($k eq 'cf_time') { + $_ = "$k='" . localtime(time) . "'\n" if $v =~ /^\s*'\s*'/; + } + elsif (exists $opt{$k}) { + $_ = "$k='$opt{$k}'\n"; + } } - } - print; - } + print; +} |