summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorSlaven Rezic <slaven@rezic.de>2003-11-30 23:16:59 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-12-02 21:45:12 +0000
commit9c4673c112c9c6db503869f421b813d3c489a10e (patch)
treec3ee0506a45c307da1e4ce7ecd9997bb987adf95 /x2p
parentad7eccf4e20fc02a9040decd348da03cb4b3de1a (diff)
downloadperl-9c4673c112c9c6db503869f421b813d3c489a10e.tar.gz
Re: [perl #24574] find2perl provides different results to find
Message-ID: <8765h1pnec.fsf@vran.herceg.de> (plus a note about find2perl now defaulting to -print in perldelta) p4raw-id: //depot/perl@21834
Diffstat (limited to 'x2p')
-rw-r--r--x2p/find2perl.PL14
1 files changed, 13 insertions, 1 deletions
diff --git a/x2p/find2perl.PL b/x2p/find2perl.PL
index 94cf242306..679ca3c05c 100644
--- a/x2p/find2perl.PL
+++ b/x2p/find2perl.PL
@@ -80,6 +80,7 @@ my $out = '';
my $declaresubs = "sub wanted;\n";
my %init = ();
my ($follow_in_effect,$Skip_And) = (0,0);
+my $print_needed = 1;
while (@ARGV) {
$_ = shift;
@@ -117,8 +118,10 @@ while (@ARGV) {
$out .= tab . "-$filetest _";
} elsif ($_ eq 'print') {
$out .= tab . 'print("$name\n")';
+ $print_needed = 0;
} elsif ($_ eq 'print0') {
$out .= tab . 'print("$name\0")';
+ $print_needed = 0;
} elsif ($_ eq 'fstype') {
my $type = shift;
$out .= tab;
@@ -183,6 +186,7 @@ while (@ARGV) {
$declaresubs .= "sub doexec (\$\@);\n";
$init{doexec} = 1;
}
+ $print_needed = 0;
} elsif ($_ eq 'ok') {
my @cmd = ();
while (@ARGV && $ARGV[0] ne ';')
@@ -194,6 +198,7 @@ while (@ARGV) {
{ local $" = "','"; $out .= "doexec(1, '@cmd')"; }
$declaresubs .= "sub doexec (\$\@);\n";
$init{doexec} = 1;
+ $print_needed = 0;
} elsif ($_ eq 'prune') {
$out .= tab . '($File::Find::prune = 1)';
} elsif ($_ eq 'xdev') {
@@ -217,6 +222,7 @@ while (@ARGV) {
$out .= tab . "ls";
$declaresubs .= "sub ls ();\n";
$init{ls} = 1;
+ $print_needed = 0;
} elsif ($_ eq 'tar') {
die "-tar must have a filename argument\n" unless @ARGV;
my $file = shift;
@@ -258,6 +264,10 @@ while (@ARGV) {
}
}
+if ($print_needed) {
+ $out .= "\n" . tab . '&& print("$name\n")';
+}
+
print <<"END";
$startperl
@@ -833,7 +843,9 @@ True if last-modified time of file matches N.
=item C<-print>
-Print out path of file (always true).
+Print out path of file (always true). If none of C<-exec>, C<-ls>,
+C<-print0>, or C<-ok> is specified, then C<-print> will be added
+implicitly.
=item C<-print0>