From c25c5c3c87d89b68324dc98b7c8aaabc750c7cec Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 29 Apr 1999 22:53:00 +0000 Subject: perl5.005_03 (stock) --- gnu/usr.bin/perl/win32/config_sh.PL | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'gnu/usr.bin/perl/win32/config_sh.PL') diff --git a/gnu/usr.bin/perl/win32/config_sh.PL b/gnu/usr.bin/perl/win32/config_sh.PL index 0769ef31120..1d4b2fb5c35 100644 --- a/gnu/usr.bin/perl/win32/config_sh.PL +++ b/gnu/usr.bin/perl/win32/config_sh.PL @@ -1,3 +1,15 @@ +# take a semicolon separated path list and turn it into a quoted +# list of paths that Text::Parsewords will grok +sub mungepath { + my $p = shift; + # remove leading/trailing semis/spaces + $p =~ s/^[ ;]+//; + $p =~ s/[ ;]+$//; + $p =~ s/'/"/g; + my @p = map { $_ = "\"$_\"" if /\s/ and !/^".*"$/; $_ } split /;/, $p; + return join(' ', @p); +} + my %opt; while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/) { @@ -5,6 +17,8 @@ while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/) shift(@ARGV); } +$opt{VERSION} = $]; +$opt{INST_VER} =~ s|~VERSION~|$]|g; if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true $opt{PATCHLEVEL} = int($1 || 0); $opt{SUBVERSION} = $2 || '00'; @@ -13,11 +27,23 @@ if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true $opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'}; $opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0] unless $opt{'cf_email'}; +$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; - $_ = "$1='$opt{$1}'\n" if (/^([\w_]+)=/ && exists($opt{$1})); + if (/^([\w_]+)=(.*)$/) { + # this depends on cf_time being empty in the template (or we'll get a loop) + if ($1 eq 'cf_time') { + $_ = "$1='" . localtime(time) . "'\n" if $2 =~ /^\s*'\s*'/; + } + elsif (exists $opt{$1}) { + $_ = "$1='$opt{$1}'\n"; + } + } print; } -- cgit v1.2.3