X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=x2p%2Fs2p.PL;h=4b2daa918dd190b3b2b27462e2b6a16cd45a82f5;hb=8bbf3450a1ff0a3996dade29a4194cc0939d871f;hp=73f67872de1bf098529d0431dce95daa723ed0bb;hpb=774d564bb7dd1ed64ca0d7e534aa67e93f991f02;p=p5sagit%2Fp5-mst-13.2.git diff --git a/x2p/s2p.PL b/x2p/s2p.PL index 73f6787..4b2daa9 100644 --- a/x2p/s2p.PL +++ b/x2p/s2p.PL @@ -1,7 +1,29 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl use Config; use File::Basename qw(&basename &dirname); +use Cwd; +use subs qw(link); + +sub link { # This is a cut-down version of installperl:link(). + my($from,$to) = @_; + my($success) = 0; + + eval { + CORE::link($from, $to) + ? $success++ + : ($from =~ m#^/afs/# || $to =~ m#^/afs/#) + ? die "AFS" # okay inside eval {} + : die "Couldn't link $from to $to: $!\n"; + }; + if ($@) { + require File::Copy; + File::Copy::copy($from, $to) + ? $success++ + : warn "Couldn't copy $from to $to: $!\n"; + } + $success; +} # List explicitly here the variables you want Configure to # generate. Metaconfig only looks for shell variables, so you @@ -12,6 +34,7 @@ use File::Basename qw(&basename &dirname); # This forces PL files to create target in same directory as PL file. # This is so that make depend always knows where to find PL derivatives. +$origdir = cwd; chdir dirname($0); $file = basename($0, '.PL'); $file .= '.com' if $^O eq 'VMS'; @@ -27,827 +50,2009 @@ print OUT <<"!GROK!THIS!"; $Config{startperl} eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' if \$running_under_some_shell; -\$startperl = "$Config{startperl}"; -\$perlpath = "$Config{perlpath}"; +my \$startperl; +my \$perlpath; +(\$startperl = <<'/../') =~ s/\\s*\\z//; +$Config{startperl} +/../ +(\$perlpath = <<'/../') =~ s/\\s*\\z//; +$Config{perlpath} +/../ !GROK!THIS! # In the following, perl variables are not expanded during extraction. print OUT <<'!NO!SUBS!'; -# $RCSfile: s2p.SH,v $$Revision: 4.1 $$Date: 92/08/07 18:29:23 $ -# -# $Log: s2p.SH,v $ +$0 =~ s/^.*?(\w+)[\.\w]*$/$1/; + +# (p)sed - a stream editor +# History: Aug 12 2000: Original version. +# Mar 25 2002: Rearrange generated Perl program. + +use strict; +use integer; +use Symbol; =head1 NAME -s2p - Sed to Perl translator +psed - a stream editor =head1 SYNOPSIS -B + psed [-an] script [file ...] + psed [-an] [-e script] [-f script-file] [file ...] + + s2p [-an] [-e script] [-f script-file] =head1 DESCRIPTION -I takes a sed script specified on the command line (or from -standard input) and produces a comparable I script on the -standard output. +A stream editor reads the input stream consisting of the specified files +(or standard input, if none are given), processes is line by line by +applying a script consisting of edit commands, and writes resulting lines +to standard output. The filename `C<->' may be used to read standard input. + +The edit script is composed from arguments of B<-e> options and +script-files, in the given order. A single script argument may be specified +as the first parameter. -=head2 Options +If this program is invoked with the name F, it will act as a +sed-to-Perl translator. See L<"sed Script Translation">. -Options include: +B returns an exit code of 0 on success or >0 if an error occurred. -=over 5 +=head1 OPTIONS -=item B<-DEnumberE> +=over 4 -sets debugging flags. +=item B<-a> + +A file specified as argument to the B edit command is by default +opened before input processing starts. Using B<-a>, opening of such +files is delayed until the first line is actually written to the file. + +=item B<-e> I