Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / bin / find2perl
blobfd2a7b2f37fc783d0064a5592b1b4097fcecbdf7
1 #!/usr/bin/perl
2 eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
3 if $running_under_some_shell;
4 (my $perlpath = <<'/../') =~ s/\s*\z//;
5 /usr/bin/perl
6 /../
7 use strict;
8 use vars qw/$statdone/;
9 use File::Spec::Functions 'curdir';
10 my $startperl = "#! $perlpath -w";
13 # Modified September 26, 1993 to provide proper handling of years after 1999
14 # Tom Link <tml+@pitt.edu>
15 # University of Pittsburgh
17 # Modified April 7, 1998 with nasty hacks to implement the troublesome -follow
18 # Billy Constantine <wdconsta@cs.adelaide.edu.au> <billy@smug.adelaide.edu.au>
19 # University of Adelaide, Adelaide, South Australia
21 # Modified 1999-06-10, 1999-07-07 to migrate to cleaner perl5 usage
22 # Ken Pizzini <ken@halcyon.com>
24 # Modified 2000-01-28 to use the 'follow' option of File::Find
26 my @roots = ();
27 while ($ARGV[0] =~ /^[^-!(]/) {
28 push(@roots, shift);
30 @roots = (curdir()) unless @roots;
31 for (@roots) { $_ = &quote($_) }
32 my $roots = join(', ', @roots);
34 my $find = "find";
35 my $indent_depth = 1;
36 my $stat = 'lstat';
37 my $decl = '';
38 my $flushall = '';
39 my $initfile = '';
40 my $initnewer = '';
41 my $out = '';
42 my %init = ();
43 my ($follow_in_effect,$Skip_And) = (0,0);
45 while (@ARGV) {
46 $_ = shift;
47 s/^-// || /^[()!]/ || die "Unrecognized switch: $_\n";
48 if ($_ eq '(') {
49 $out .= &tab . "(\n";
50 $indent_depth++;
51 next;
52 } elsif ($_ eq ')') {
53 --$indent_depth;
54 $out .= &tab . ")";
55 } elsif ($_ eq 'follow') {
56 $follow_in_effect= 1;
57 $stat = 'stat';
58 $Skip_And= 1;
59 } elsif ($_ eq '!') {
60 $out .= &tab . "!";
61 next;
62 } elsif ($_ eq 'name') {
63 $out .= &tab . '/' . &fileglob_to_re(shift) . "/s";
64 } elsif ($_ eq 'perm') {
65 my $onum = shift;
66 $onum =~ /^-?[0-7]+$/
67 || die "Malformed -perm argument: $onum\n";
68 $out .= &tab;
69 if ($onum =~ s/^-//) {
70 $onum = sprintf("0%o", oct($onum) & 07777);
71 $out .= "((\$mode & $onum) == $onum)";
72 } else {
73 $onum =~ s/^0*/0/;
74 $out .= "((\$mode & 0777) == $onum)";
76 } elsif ($_ eq 'type') {
77 (my $filetest = shift) =~ tr/s/S/;
78 $out .= &tab . "-$filetest _";
79 } elsif ($_ eq 'print') {
80 $out .= &tab . 'print("$name\n")';
81 } elsif ($_ eq 'print0') {
82 $out .= &tab . 'print("$name\0")';
83 } elsif ($_ eq 'fstype') {
84 my $type = shift;
85 $out .= &tab;
86 if ($type eq 'nfs') {
87 $out .= '($dev < 0)';
88 } else {
89 $out .= '($dev >= 0)'; #XXX
91 } elsif ($_ eq 'user') {
92 my $uname = shift;
93 $out .= &tab . "(\$uid == \$uid{'$uname'})";
94 $init{user} = 1;
95 } elsif ($_ eq 'group') {
96 my $gname = shift;
97 $out .= &tab . "(\$gid == \$gid{'$gname'})";
98 $init{group} = 1;
99 } elsif ($_ eq 'nouser') {
100 $out .= &tab . '!exists $uid{$uid}';
101 $init{user} = 1;
102 } elsif ($_ eq 'nogroup') {
103 $out .= &tab . '!exists $gid{$gid}';
104 $init{group} = 1;
105 } elsif ($_ eq 'links') {
106 $out .= &tab . &n('$nlink', shift);
107 } elsif ($_ eq 'inum') {
108 $out .= &tab . &n('$ino', shift);
109 } elsif ($_ eq 'size') {
110 $_ = shift;
111 my $n = 'int(((-s _) + 511) / 512)';
112 if (s/c\z//) {
113 $n = 'int(-s _)';
114 } elsif (s/k\z//) {
115 $n = 'int(((-s _) + 1023) / 1024)';
117 $out .= &tab . &n($n, $_);
118 } elsif ($_ eq 'atime') {
119 $out .= &tab . &n('int(-A _)', shift);
120 } elsif ($_ eq 'mtime') {
121 $out .= &tab . &n('int(-M _)', shift);
122 } elsif ($_ eq 'ctime') {
123 $out .= &tab . &n('int(-C _)', shift);
124 } elsif ($_ eq 'exec') {
125 my @cmd = ();
126 while (@ARGV && $ARGV[0] ne ';')
127 { push(@cmd, shift) }
128 shift;
129 $out .= &tab;
130 if ($cmd[0] =~m#^(?:(?:/usr)?/bin/)?rm$#
131 && $cmd[$#cmd] eq '{}'
132 && (@cmd == 2 || (@cmd == 3 && $cmd[1] eq '-f'))) {
133 if (@cmd == 2) {
134 $out .= '(unlink($_) || warn "$name: $!\n")';
135 } elsif (!@ARGV) {
136 $out .= 'unlink($_)';
137 } else {
138 $out .= '(unlink($_) || 1)';
140 } else {
141 for (@cmd)
142 { s/'/\\'/g }
143 { local $" = "','"; $out .= "&doexec(0, '@cmd')"; }
144 $init{doexec} = 1;
146 } elsif ($_ eq 'ok') {
147 my @cmd = ();
148 while (@ARGV && $ARGV[0] ne ';')
149 { push(@cmd, shift) }
150 shift;
151 $out .= &tab;
152 for (@cmd)
153 { s/'/\\'/g }
154 { local $" = "','"; $out .= "&doexec(0, '@cmd')"; }
155 $init{doexec} = 1;
156 } elsif ($_ eq 'prune') {
157 $out .= &tab . '($File::Find::prune = 1)';
158 } elsif ($_ eq 'xdev') {
159 $out .= &tab . '!($File::Find::prune |= ($dev != $File::Find::topdev))'
161 } elsif ($_ eq 'newer') {
162 my $file = shift;
163 my $newername = 'AGE_OF' . $file;
164 $newername =~ s/\W/_/g;
165 $newername = '$' . $newername;
166 $out .= &tab . "(-M _ < $newername)";
167 $initnewer .= "my $newername = -M " . &quote($file) . ";\n";
168 } elsif ($_ eq 'eval') {
169 my $prog = shift;
170 $prog =~ s/'/\\'/g;
171 $out .= &tab . "eval {$prog}";
172 } elsif ($_ eq 'depth') {
173 $find = 'finddepth';
174 next;
175 } elsif ($_ eq 'ls') {
176 $out .= &tab . "&ls";
177 $init{ls} = 1;
178 } elsif ($_ eq 'tar') {
179 die "-tar must have a filename argument\n" unless @ARGV;
180 my $file = shift;
181 my $fh = 'FH' . $file;
182 $fh =~ s/\W/_/g;
183 $out .= &tab . "&tar(*$fh, \$name)";
184 $flushall .= "&tflushall;\n";
185 $initfile .= "open($fh, " . &quote('> ' . $file) .
186 qq{) || die "Can't open $fh: \$!\\n";\n};
187 $init{tar} = 1;
188 } elsif (/^(n?)cpio\z/) {
189 die "-$_ must have a filename argument\n" unless @ARGV;
190 my $file = shift;
191 my $fh = 'FH' . $file;
192 $fh =~ s/\W/_/g;
193 $out .= &tab . "&cpio(*$fh, \$name, '$1')";
194 $find = 'finddepth';
195 $flushall .= "&cflushall;\n";
196 $initfile .= "open($fh, " . &quote('> ' . $file) .
197 qq{) || die "Can't open $fh: \$!\\n";\n};
198 $init{cpio} = 1;
199 } else {
200 die "Unrecognized switch: -$_\n";
203 if (@ARGV) {
204 if ($ARGV[0] eq '-o') {
205 { local($statdone) = 1; $out .= "\n" . &tab . "||\n"; }
206 $statdone = 0 if $indent_depth == 1 && exists $init{delayedstat};
207 $init{saw_or} = 1;
208 shift;
209 } else {
210 $out .= " &&" unless $Skip_And || $ARGV[0] eq ')';
211 $out .= "\n";
212 shift if $ARGV[0] eq '-a';
218 print <<"END";
219 $startperl
220 eval 'exec $perlpath -S \$0 \${1+"\$@"}'
221 if 0; #\$running_under_some_shell
223 use strict;
224 use File::Find ();
226 # Set the variable \$File::Find::dont_use_nlink if you're using AFS,
227 # since AFS cheats.
229 # for the convenience of &wanted calls, including -eval statements:
230 use vars qw/*name *dir *prune/;
231 *name = *File::Find::name;
232 *dir = *File::Find::dir;
233 *prune = *File::Find::prune;
238 if (exists $init{ls}) {
239 print <<'END';
240 my @rwx = qw(--- --x -w- -wx r-- r-x rw- rwx);
241 my @moname = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
246 if (exists $init{user} || exists $init{ls} || exists $init{tar}) {
247 print "my (%uid, %user);\n";
248 print "while (my (\$name, \$pw, \$uid) = getpwent) {\n";
249 print ' $uid{$name} = $uid{$uid} = $uid;', "\n"
250 if exists $init{user};
251 print ' $user{$uid} = $name unless exists $user{$uid};', "\n"
252 if exists $init{ls} || exists $init{tar};
253 print "}\n\n";
256 if (exists $init{group} || exists $init{ls} || exists $init{tar}) {
257 print "my (%gid, %group);\n";
258 print "while (my (\$name, \$pw, \$gid) = getgrent) {\n";
259 print ' $gid{$name} = $gid{$gid} = $gid;', "\n"
260 if exists $init{group};
261 print ' $group{$gid} = $name unless exists $group{$gid};', "\n"
262 if exists $init{ls} || exists $init{tar};
263 print "}\n\n";
266 print $initnewer, "\n" if $initnewer ne '';
267 print $initfile, "\n" if $initfile ne '';
268 $flushall .= "exit;\n";
269 if (exists $init{declarestat}) {
270 $out = <<'END' . $out;
271 my ($dev,$ino,$mode,$nlink,$uid,$gid);
276 if ( $follow_in_effect ) {
277 $out =~ s/lstat\(\$_\)/lstat(_)/;
278 print <<"END";
279 $decl
280 # Traverse desired filesystems
281 File::Find::$find( {wanted => \\&wanted, follow => 1}, $roots);
282 $flushall
284 sub wanted {
285 $out;
289 } else {
290 print <<"END";
291 $decl
292 # Traverse desired filesystems
293 File::Find::$find({wanted => \\&wanted}, $roots);
294 $flushall
296 sub wanted {
297 $out;
303 if (exists $init{doexec}) {
304 print <<'END';
306 use Cwd ();
307 my $cwd = Cwd::cwd();
309 sub doexec {
310 my $ok = shift;
311 for my $word (@_)
312 { $word =~ s#{}#$name#g }
313 if ($ok) {
314 my $old = select(STDOUT);
315 $| = 1;
316 print "@_";
317 select($old);
318 return 0 unless <STDIN> =~ /^y/;
320 chdir $cwd; #sigh
321 system @_;
322 chdir $File::Find::dir;
323 return !$?;
329 if (exists $init{ls}) {
330 print <<'INTRO', <<"SUB", <<'END';
332 sub sizemm {
333 my $rdev = shift;
334 sprintf("%3d, %3d", ($rdev >> 8) & 0xff, $rdev & 0xff);
337 sub ls {
338 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
339 INTRO
340 \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_);
342 my $pname = $name;
344 $blocks
345 or $blocks = int(($size + 1023) / 1024);
347 my $perms = $rwx[$mode & 7];
348 $mode >>= 3;
349 $perms = $rwx[$mode & 7] . $perms;
350 $mode >>= 3;
351 $perms = $rwx[$mode & 7] . $perms;
352 substr($perms, 2, 1) =~ tr/-x/Ss/ if -u _;
353 substr($perms, 5, 1) =~ tr/-x/Ss/ if -g _;
354 substr($perms, 8, 1) =~ tr/-x/Tt/ if -k _;
355 if (-f _) { $perms = '-' . $perms; }
356 elsif (-d _) { $perms = 'd' . $perms; }
357 elsif (-l _) { $perms = 'l' . $perms; $pname .= ' -> ' . readlink($_); }
358 elsif (-c _) { $perms = 'c' . $perms; $size = sizemm($rdev); }
359 elsif (-b _) { $perms = 'b' . $perms; $size = sizemm($rdev); }
360 elsif (-p _) { $perms = 'p' . $perms; }
361 elsif (-S _) { $perms = 's' . $perms; }
362 else { $perms = '?' . $perms; }
364 my $user = $user{$uid} || $uid;
365 my $group = $group{$gid} || $gid;
367 my ($sec,$min,$hour,$mday,$mon,$timeyear) = localtime($mtime);
368 if (-M _ > 365.25 / 2) {
369 $timeyear += 1900;
370 } else {
371 $timeyear = sprintf("%02d:%02d", $hour, $min);
374 printf "%5lu %4ld %-10s %3d %-8s %-8s %8s %s %2d %5s %s\n",
375 $ino,
376 $blocks,
377 $perms,
378 $nlink,
379 $user,
380 $group,
381 $size,
382 $moname[$mon],
383 $mday,
384 $timeyear,
385 $pname;
393 if (exists $init{cpio} || exists $init{tar}) {
394 print <<'END';
396 my %blocks = ();
398 sub flush {
399 my ($fh, $varref, $blksz) = @_;
401 while (length($$varref) >= $blksz) {
402 no strict qw/refs/;
403 syswrite($fh, $$varref, $blksz);
404 substr($$varref, 0, $blksz) = '';
405 ++$blocks{$fh};
413 if (exists $init{cpio}) {
414 print <<'INTRO', <<"SUB", <<'END';
416 my %cpout = ();
417 my %nc = ();
419 sub cpio {
420 my ($fh, $fname, $nc) = @_;
421 my $text = '';
422 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
423 $atime,$mtime,$ctime,$blksize,$blocks);
424 local (*IN);
426 if ( ! defined $fname ) {
427 $fname = 'TRAILER!!!';
428 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
429 $atime,$mtime,$ctime,$blksize,$blocks) = (0) x 13;
430 } else {
431 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
432 INTRO
433 \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_);
435 if (-f _) {
436 open(IN, "./$_\0") || do {
437 warn "Couldn't open $fname: $!\n";
438 return;
440 } else {
441 $text = readlink($_);
442 $size = 0 unless defined $text;
446 $fname =~ s#^\./##;
447 $nc{$fh} = $nc;
448 if ($nc eq 'n') {
449 $cpout{$fh} .=
450 sprintf("%06o%06o%06o%06o%06o%06o%06o%06o%011lo%06o%011lo%s\0",
451 070707,
452 $dev & 0777777,
453 $ino & 0777777,
454 $mode & 0777777,
455 $uid & 0777777,
456 $gid & 0777777,
457 $nlink & 0777777,
458 $rdev & 0177777,
459 $mtime,
460 length($fname)+1,
461 $size,
462 $fname);
463 } else {
464 $cpout{$fh} .= "\0" if length($cpout{$fh}) & 1;
465 $cpout{$fh} .= pack("SSSSSSSSLSLa*",
466 070707, $dev, $ino, $mode, $uid, $gid, $nlink, $rdev, $mtime,
467 length($fname)+1, $size,
468 $fname . (length($fname) & 1 ? "\0" : "\0\0"));
471 if ($text ne '') {
472 $cpout{$fh} .= $text;
473 } elsif ($size) {
474 my $l;
475 flush($fh, \$cpout{$fh}, 5120)
476 while ($l = length($cpout{$fh})) >= 5120;
477 while (sysread(IN, $cpout{$fh}, 5120 - $l, $l)) {
478 flush($fh, \$cpout{$fh}, 5120);
479 $l = length($cpout{$fh});
481 close IN;
485 sub cflushall {
486 for my $fh (keys %cpout) {
487 &cpio($fh, undef, $nc{$fh});
488 $cpout{$fh} .= "0" x (5120 - length($cpout{$fh}));
489 flush($fh, \$cpout{$fh}, 5120);
490 print $blocks{$fh} * 10, " blocks\n";
497 if (exists $init{tar}) {
498 print <<'INTRO', <<"SUB", <<'END';
500 my %tarout = ();
501 my %linkseen = ();
503 sub tar {
504 my ($fh, $fname) = @_;
505 my $prefix = '';
506 my $typeflag = '0';
507 my $linkname;
508 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
509 INTRO
510 \$atime,\$mtime,\$ctime,\$blksize,\$blocks) = $stat(_);
512 local (*IN);
514 if ($nlink > 1) {
515 if ($linkname = $linkseen{$fh, $dev, $ino}) {
516 if (length($linkname) > 100) {
517 warn "$0: omitting file with linkname ",
518 "too long for tar output: $linkname\n";
519 return;
521 $typeflag = '1';
522 $size = 0;
523 } else {
524 $linkseen{$fh, $dev, $ino} = $fname;
527 if ($typeflag eq '0') {
528 if (-f _) {
529 open(IN, "./$_\0") || do {
530 warn "Couldn't open $fname: $!\n";
531 return;
533 } else {
534 $linkname = readlink($_);
535 if (defined $linkname) { $typeflag = '2' }
536 elsif (-c _) { $typeflag = '3' }
537 elsif (-b _) { $typeflag = '4' }
538 elsif (-d _) { $typeflag = '5' }
539 elsif (-p _) { $typeflag = '6' }
543 if (length($fname) > 100) {
544 ($prefix, $fname) = ($fname =~ m#\A(.*?)/(.{,100})\Z(?!\n)#);
545 if (!defined($fname) || length($prefix) > 155) {
546 warn "$0: omitting file with name too long for tar output: ",
547 $fname, "\n";
548 return;
552 $size = 0 if $typeflag ne '0';
553 my $header = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155",
554 $fname,
555 sprintf("%7o ", $mode & 0777),
556 sprintf("%7o ", $uid & 0777777),
557 sprintf("%7o ", $gid & 0777777),
558 sprintf("%11o ", $size),
559 sprintf("%11o ", $mtime),
560 ' 'x8,
561 $typeflag,
562 defined $linkname ? $linkname : '',
563 "ustar\0",
564 "00",
565 $user{$uid},
566 $group{$gid},
567 ($rdev >> 8) & 0xff,
568 $rdev & 0xff,
569 $prefix,
571 substr($header, 148, 8) = sprintf("%7o ", unpack("%16C*", $header));
572 my $l = length($header) % 512;
573 $tarout{$fh} .= $header;
574 $tarout{$fh} .= "\0" x (512 - $l) if $l;
576 if ($size) {
577 flush($fh, \$tarout{$fh}, 10240)
578 while ($l = length($tarout{$fh})) >= 10240;
579 while (sysread(IN, $tarout{$fh}, 10240 - $l, $l)) {
580 my $slop = length($tarout{$fh}) % 512;
581 $tarout{$fh} .= "\0" x (512 - $slop) if $slop;
582 flush($fh, \$tarout{$fh}, 10240);
583 $l = length($tarout{$fh});
585 close IN;
589 sub tflushall {
590 my $len;
591 for my $fh (keys %tarout) {
592 $len = 10240 - length($tarout{$fh});
593 $len += 10240 if $len < 1024;
594 $tarout{$fh} .= "\0" x $len;
595 flush($fh, \$tarout{$fh}, 10240);
602 exit;
604 ############################################################################
606 sub tab {
607 my $tabstring;
609 $tabstring = "\t" x ($indent_depth/2) . ' ' x ($indent_depth%2 * 4);
610 if (!$statdone) {
611 if ($_ =~ /^(?:name|print|prune|exec|ok|\(|\))/) {
612 $init{delayedstat} = 1;
613 } else {
614 my $statcall = '(($dev,$ino,$mode,$nlink,$uid,$gid) = '
615 . $stat . '($_))';
616 if (exists $init{saw_or}) {
617 $tabstring .= "(\$nlink || $statcall) &&\n" . $tabstring;
618 } else {
619 $tabstring .= "$statcall &&\n" . $tabstring;
621 $statdone = 1;
622 $init{declarestat} = 1;
625 $tabstring =~ s/^\s+/ / if $out =~ /!$/;
626 $tabstring;
629 sub fileglob_to_re {
630 my $x = shift;
631 $x =~ s#([./^\$()])#\\$1#g;
632 $x =~ s#([?*])#.$1#g;
633 "^$x\\z";
636 sub n {
637 my ($pre, $n) = @_;
638 $n =~ s/^-/< / || $n =~ s/^\+/> / || $n =~ s/^/== /;
639 $n =~ s/ 0*(\d)/ $1/;
640 "($pre $n)";
643 sub quote {
644 my $string = shift;
645 $string =~ s/\\/\\\\/g;
646 $string =~ s/'/\\'/g;
647 "'$string'";
650 __END__
652 =head1 NAME
654 find2perl - translate find command lines to Perl code
656 =head1 SYNOPSIS
658 find2perl [paths] [predicates] | perl
660 =head1 DESCRIPTION
662 find2perl is a little translator to convert find command lines to
663 equivalent Perl code. The resulting code is typically faster than
664 running find itself.
666 "paths" are a set of paths where find2perl will start its searches and
667 "predicates" are taken from the following list.
669 =over 4
671 =item C<! PREDICATE>
673 Negate the sense of the following predicate. The C<!> must be passed as
674 a distinct argument, so it may need to be surrounded by whitespace and/or
675 quoted from interpretation by the shell using a backslash (just as with
676 using C<find(1)>).
678 =item C<( PREDICATES )>
680 Group the given PREDICATES. The parentheses must be passed as distinct
681 arguments, so they may need to be surrounded by whitespace and/or
682 quoted from interpretation by the shell using a backslash (just as with
683 using C<find(1)>).
685 =item C<PREDICATE1 PREDICATE2>
687 True if _both_ PREDICATE1 and PREDICATE2 are true; PREDICATE2 is not
688 evaluated if PREDICATE1 is false.
690 =item C<PREDICATE1 -o PREDICATE2>
692 True if either one of PREDICATE1 or PREDICATE2 is true; PREDICATE2 is
693 not evaluated if PREDICATE1 is true.
695 =item C<-follow>
697 Follow (dereference) symlinks. The checking of file attributes depends
698 on the position of the C<-follow> option. If it precedes the file
699 check option, an C<stat> is done which means the file check applies to the
700 file the symbolic link is pointing to. If C<-follow> option follows the
701 file check option, this now applies to the symbolic link itself, i.e.
702 an C<lstat> is done.
704 =item C<-depth>
706 Change directory traversal algorithm from breadth-first to depth-first.
708 =item C<-prune>
710 Do not descend into the directory currently matched.
712 =item C<-xdev>
714 Do not traverse mount points (prunes search at mount-point directories).
716 =item C<-name GLOB>
718 File name matches specified GLOB wildcard pattern. GLOB may need to be
719 quoted to avoid interpretation by the shell (just as with using
720 C<find(1)>).
722 =item C<-perm PERM>
724 Low-order 9 bits of permission match octal value PERM.
726 =item C<-perm -PERM>
728 The bits specified in PERM are all set in file's permissions.
730 =item C<-type X>
732 The file's type matches perl's C<-X> operator.
734 =item C<-fstype TYPE>
736 Filesystem of current path is of type TYPE (only NFS/non-NFS distinction
737 is implemented).
739 =item C<-user USER>
741 True if USER is owner of file.
743 =item C<-group GROUP>
745 True if file's group is GROUP.
747 =item C<-nouser>
749 True if file's owner is not in password database.
751 =item C<-nogroup>
753 True if file's group is not in group database.
755 =item C<-inum INUM>
757 True file's inode number is INUM.
759 =item C<-links N>
761 True if (hard) link count of file matches N (see below).
763 =item C<-size N>
765 True if file's size matches N (see below) N is normally counted in
766 512-byte blocks, but a suffix of "c" specifies that size should be
767 counted in characters (bytes) and a suffix of "k" specifes that
768 size should be counted in 1024-byte blocks.
770 =item C<-atime N>
772 True if last-access time of file matches N (measured in days) (see
773 below).
775 =item C<-ctime N>
777 True if last-changed time of file's inode matches N (measured in days,
778 see below).
780 =item C<-mtime N>
782 True if last-modified time of file matches N (measured in days, see below).
784 =item C<-newer FILE>
786 True if last-modified time of file matches N.
788 =item C<-print>
790 Print out path of file (always true).
792 =item C<-print0>
794 Like -print, but terminates with \0 instead of \n.
796 =item C<-exec OPTIONS ;>
798 exec() the arguments in OPTIONS in a subprocess; any occurence of {} in
799 OPTIONS will first be substituted with the path of the current
800 file. Note that the command "rm" has been special-cased to use perl's
801 unlink() function instead (as an optimization). The C<;> must be passed as
802 a distinct argument, so it may need to be surrounded by whitespace and/or
803 quoted from interpretation by the shell using a backslash (just as with
804 using C<find(1)>).
806 =item C<-ok OPTIONS ;>
808 Like -exec, but first prompts user; if user's response does not begin
809 with a y, skip the exec. The C<;> must be passed as
810 a distinct argument, so it may need to be surrounded by whitespace and/or
811 quoted from interpretation by the shell using a backslash (just as with
812 using C<find(1)>).
814 =item C<-eval EXPR>
816 Has the perl script eval() the EXPR.
818 =item C<-ls>
820 Simulates C<-exec ls -dils {} ;>
822 =item C<-tar FILE>
824 Adds current output to tar-format FILE.
826 =item C<-cpio FILE>
828 Adds current output to old-style cpio-format FILE.
830 =item C<-ncpio FILE>
832 Adds current output to "new"-style cpio-format FILE.
834 =back
836 Predicates which take a numeric argument N can come in three forms:
838 * N is prefixed with a +: match values greater than N
839 * N is prefixed with a -: match values less than N
840 * N is not prefixed with either + or -: match only values equal to N
842 =head1 SEE ALSO
844 find
846 =cut