summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-05-18 09:40:58 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-05-18 09:40:58 +0000
commit3666098248b43282bda1153dae2f4c1e4af38d09 (patch)
tree9c69a323f89cdd81b231dc630b0eaf134225da7a /x2p
parent9e6b2b00f0190751b970ece3db7033405cb08ca5 (diff)
parentd2719217c9b7910115cef7ea0c16d68e6b286cf7 (diff)
downloadperl-3666098248b43282bda1153dae2f4c1e4af38d09.tar.gz
[asperl] integrate mainline changes (untested)
p4raw-id: //depot/asperl@1010
Diffstat (limited to 'x2p')
-rwxr-xr-xx2p/Makefile.SH8
-rw-r--r--x2p/find2perl.PL51
2 files changed, 42 insertions, 17 deletions
diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH
index bf7495a39b..30201bdeda 100755
--- a/x2p/Makefile.SH
+++ b/x2p/Makefile.SH
@@ -61,6 +61,7 @@ FIRSTMAKEFILE = $firstmakefile
cat >>Makefile <<'!NO!SUBS!'
+REALPERL = ../perl
CCCMD = `sh $(shellflags) cflags $@`
public = a2p s2p find2perl
@@ -76,6 +77,8 @@ shextract = Makefile cflags
pl = find2perl.PL s2p.PL
plextract = find2perl s2p
+plexe = find2perl.exe s2p.exe
+plc = find2perl.c s2p.c
addedbyconf = $(shextract) $(plextract)
@@ -94,6 +97,9 @@ lintflags = -phbvxac
all: $(public) $(private) $(util)
touch all
+compile: all
+ $(REALPERL) -I../lib ../utils/perlcc -regex 's/$$/.exe/' $(plextract) -prog -verbose dcf -log ../compilelog;
+
a2p: $(obj) a2p$(OBJ_EXT)
$(CC) $(LDFLAGS) $(obj) a2p$(OBJ_EXT) $(libs) -o a2p
@@ -116,7 +122,7 @@ a2p$(OBJ_EXT): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h \
$(CCCMD) $(LARGE) a2p.c
clean:
- rm -f a2p *$(OBJ_EXT)
+ rm -f a2p *$(OBJ_EXT) $(plexe) $(plc)
realclean: clean
rm -f *.orig core $(addedbyconf) all malloc.c
diff --git a/x2p/find2perl.PL b/x2p/find2perl.PL
index c23fc923a8..ea13c710f9 100644
--- a/x2p/find2perl.PL
+++ b/x2p/find2perl.PL
@@ -26,7 +26,7 @@ print "Extracting $file (with variable substitutions)\n";
print OUT <<"!GROK!THIS!";
$Config{startperl}
eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
- if \$running_under_some_shell;
+ if \$running_under_some_shell;
\$startperl = "$Config{startperl}";
\$perlpath = "$Config{perlpath}";
!GROK!THIS!
@@ -34,10 +34,16 @@ $Config{startperl}
# In the following, perl variables are not expanded during extraction.
print OUT <<'!NO!SUBS!';
+
#
# Modified September 26, 1993 to provide proper handling of years after 1999
# Tom Link <tml+@pitt.edu>
# University of Pittsburgh
+#
+# Modified April 7, 1998 with nasty hacks to implement the troublesome -follow
+# Billy Constantine <wdconsta@cs.adelaide.edu.au> <billy@smug.adelaide.edu.au>
+# University of Adelaide, Adelaide, South Australia
+#
while ($ARGV[0] =~ /^[^-!(]/) {
push(@roots, shift);
@@ -47,6 +53,8 @@ for (@roots) { $_ = &quote($_); }
$roots = join(',', @roots);
$indent = 1;
+$stat = 'lstat';
+$decl = '';
while (@ARGV) {
$_ = shift;
@@ -60,6 +68,12 @@ while (@ARGV) {
$indent--;
$out .= &tab . ")";
}
+ elsif ($_ eq 'follow') {
+ $stat = 'stat';
+ $decl = '%already_seen = ();';
+ $out .= &tab . '(not $already_seen{"$dev,$ino"}) &&';
+ $out .= "\n" . &tab . '(($already_seen{"$dev,$ino"} = !(-d _)) || 1)';
+ }
elsif ($_ eq '!') {
$out .= &tab . "!";
next;
@@ -178,7 +192,7 @@ while (@ARGV) {
$file = shift;
$newername = 'AGE_OF' . $file;
$newername =~ s/[^\w]/_/g;
- $newername = '$' . $newername;
+ $newername = "\$$newername";
$out .= "(-M _ < $newername)";
$initnewer .= "$newername = -M " . &quote($file) . ";\n";
}
@@ -278,10 +292,10 @@ require "$find.pl";
# Traverse desired filesystems
+$decl
&$find($roots);
$flushall
exit;
-
sub wanted {
$out;
}
@@ -312,10 +326,11 @@ END
}
if ($initls) {
- print <<'END';
+ print <<"INTERP", <<'END';
sub ls {
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizemm,
- $atime,$mtime,$ctime,$blksize,$blocks) = lstat(_);
+ (\$dev,\$ino,\$mode,\$nlink,\$uid,\$gid,\$rdev,\$sizemm,
+ \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat\(_\);
+INTERP
$pname = $name;
@@ -380,7 +395,7 @@ END
}
if ($initcpio) {
-print <<'END';
+print <<'START', <<"INTERP", <<'END';
sub cpio {
local($nc,$fh) = @_;
local($text);
@@ -390,8 +405,10 @@ sub cpio {
$size = 0;
}
else {
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
- $atime,$mtime,$ctime,$blksize,$blocks) = lstat(_);
+START
+ (\$dev,\$ino,\$mode,\$nlink,\$uid,\$gid,\$rdev,\$size,
+ \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat\(_\);
+INTERP
if (-f _) {
open(IN, "./$_\0") || do {
warn "Couldn't open $name: $!\n";
@@ -465,14 +482,16 @@ END
}
if ($inittar) {
-print <<'END';
+print <<'START', <<"INTERP", <<'END';
sub tar {
local($fh) = @_;
local($linkname,$header,$l,$slop);
local($linkflag) = "\0";
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
- $atime,$mtime,$ctime,$blksize,$blocks) = lstat(_);
+START
+ (\$dev,\$ino,\$mode,\$nlink,\$uid,\$gid,\$rdev,\$size,
+ \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat\(_\);
+INTERP
$nm = $name;
if ($nlink > 1) {
if ($linkname = $linkseen{$fh,$dev,$ino}) {
@@ -561,13 +580,13 @@ sub tab {
}
else {
if ($saw_or) {
- $tabstring .= <<'ENDOFSTAT' . $tabstring;
-($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) &&
+ $tabstring .= <<"ENDOFSTAT" . $tabstring;
+(\$nlink || ((\$dev,\$ino,\$mode,\$nlink,\$uid,\$gid) = $stat\(\$_\))) &&
ENDOFSTAT
}
else {
- $tabstring .= <<'ENDOFSTAT' . $tabstring;
-(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
+ $tabstring .= <<"ENDOFSTAT" . $tabstring;
+((\$dev,\$ino,\$mode,\$nlink,\$uid,\$gid) = $stat\(\$_\)) &&
ENDOFSTAT
}
$statdone = 1;