summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/win32/config_sh.PL
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-04-29 22:53:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-04-29 22:53:00 +0000
commitc25c5c3c87d89b68324dc98b7c8aaabc750c7cec (patch)
tree2943af9b1f84d88d863a9ba36a234877561bf5f0 /gnu/usr.bin/perl/win32/config_sh.PL
parent37583d269f066aa8aa04ea18126b188d12257e6d (diff)
perl5.005_03 (stock)
Diffstat (limited to 'gnu/usr.bin/perl/win32/config_sh.PL')
-rw-r--r--gnu/usr.bin/perl/win32/config_sh.PL28
1 files changed, 27 insertions, 1 deletions
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;
}