From 59ad941d06909cf9027c5fb10edca7d68fc7149b Mon Sep 17 00:00:00 2001 From: Ilya Zakharevich Date: Wed, 29 Oct 2003 06:00:18 -0800 Subject: OS/2 build Message-ID: <20031029220017.GA26384@math.berkeley.edu> p4raw-id: //depot/perl@21620 --- os2/perl2cmd.pl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'os2/perl2cmd.pl') diff --git a/os2/perl2cmd.pl b/os2/perl2cmd.pl index f9cc03bdac..4db40a0a31 100644 --- a/os2/perl2cmd.pl +++ b/os2/perl2cmd.pl @@ -16,14 +16,25 @@ EOU $idir = $Config{installbin}; $indir =~ s|\\|/|g ; +my %seen; + foreach $file (<$idir/*>) { - next if $file =~ /\.exe/i; + next if $file =~ /\.(exe|bak)/i; $base = $file; $base =~ s/\.$//; # just in case... $base =~ s|.*/||; - $file =~ s|/|\\|g ; + $base =~ s|\.pl$||; + #$file =~ s|/|\\|g ; + warn "Clashing output name for $file, skipping" if $seen{$base}++; print "Processing $file => $dir\\$base.cmd\n"; - system 'cmd.exe', '/c', "echo extproc perl -S>$dir\\$base.cmd"; - system 'cmd.exe', '/c', "type $file >> $dir\\$base.cmd"; + open IN, '<', $file or warn, next; + open OUT, '>', "$dir/$base.cmd" or warn, next; + my $firstline = ; + my $flags = ''; + $flags = $2 if $firstline =~ /^#!\s*(\S+)\s+-([^#]+?)\s*(#|$)/; + print OUT "extproc perl -S$flags\n$firstline"; + print OUT $_ while ; + close IN or warn, next; + close OUT or warn, next; } -- cgit v1.2.1