X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=x2p%2Ffind2perl.PL;h=e9275d0c5c57ab7f7ef1657f455e42de5e055c65;hb=b212a3c602c7ab2fcce55cf1027f73c6280d3b7b;hp=679ca3c05c747d9a12be7229bf8205556f4ab9b2;hpb=9c4673c112c9c6db503869f421b813d3c489a10e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/x2p/find2perl.PL b/x2p/find2perl.PL index 679ca3c..e9275d0 100644 --- a/x2p/find2perl.PL +++ b/x2p/find2perl.PL @@ -42,20 +42,6 @@ use vars qw/$statdone/; use File::Spec::Functions 'curdir'; my $startperl = "#! $perlpath -w"; -# -# Modified September 26, 1993 to provide proper handling of years after 1999 -# Tom Link -# University of Pittsburgh -# -# Modified April 7, 1998 with nasty hacks to implement the troublesome -follow -# Billy Constantine -# University of Adelaide, Adelaide, South Australia -# -# Modified 1999-06-10, 1999-07-07 to migrate to cleaner perl5 usage -# Ken Pizzini -# -# Modified 2000-01-28 to use the 'follow' option of File::Find - sub tab (); sub n ($$); sub fileglob_to_re ($); @@ -99,8 +85,10 @@ while (@ARGV) { } elsif ($_ eq '!') { $out .= tab . "!"; next; - } elsif ($_ eq 'name') { - $out .= tab . '/' . fileglob_to_re(shift) . "/s"; + } elsif (/^(i)?name$/) { + $out .= tab . '/' . fileglob_to_re(shift) . "/s$1"; + } elsif (/^(i)?path$/) { + $out .= tab . '$File::Find::name =~ /' . fileglob_to_re(shift) . "/s$1"; } elsif ($_ eq 'perm') { my $onum = shift; $onum =~ /^-?[0-7]+$/ @@ -215,6 +203,7 @@ while (@ARGV) { my $prog = shift; $prog =~ s/'/\\'/g; $out .= tab . "eval {$prog}"; + $print_needed = 0; } elsif ($_ eq 'depth') { $find = 'finddepth'; next; @@ -265,7 +254,9 @@ while (@ARGV) { } if ($print_needed) { - $out .= "\n" . tab . '&& print("$name\n")'; + my $t = tab; + if ($t !~ /&&\s*$/) { $t .= '&& ' } + $out .= "\n" . $t . 'print("$name\n")'; } @@ -290,6 +281,14 @@ $declaresubs END +if (exists $init{doexec}) { + print <<'END'; +use Cwd (); +my $cwd = Cwd::cwd(); + +END +} + if (exists $init{ls}) { print <<'END'; my @rwx = qw(--- --x -w- -wx r-- r-x rw- rwx); @@ -358,9 +357,6 @@ END if (exists $init{doexec}) { print <<'END'; -use Cwd (); -my $cwd = Cwd::cwd(); - sub doexec ($@) { my $ok = shift; my @command = @_; # copy so we don't try to s/// aliases to constants @@ -775,6 +771,18 @@ File name matches specified GLOB wildcard pattern. GLOB may need to be quoted to avoid interpretation by the shell (just as with using C). +=item C<-iname GLOB> + +Like C<-name>, but the match is case insensitive. + +=item C<-path GLOB> + +Path name matches specified GLOB wildcard pattern. + +=item C<-ipath GLOB> + +Like C<-path>, but the match is case insensitive. + =item C<-perm PERM> Low-order 9 bits of permission match octal value PERM. @@ -820,7 +828,7 @@ True if (hard) link count of file matches N (see below). True if file's size matches N (see below) N is normally counted in 512-byte blocks, but a suffix of "c" specifies that size should be -counted in characters (bytes) and a suffix of "k" specifes that +counted in characters (bytes) and a suffix of "k" specifies that size should be counted in 1024-byte blocks. =item C<-atime N> @@ -899,7 +907,7 @@ Predicates which take a numeric argument N can come in three forms: =head1 SEE ALSO -find +find, File::Find. =cut !NO!SUBS!