ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/bin/treescan
(Generate patch)

Comparing IO-AIO/bin/treescan (file contents):
Revision 1.4 by root, Mon Aug 23 19:19:13 2010 UTC vs.
Revision 1.5 by root, Sun Jan 9 05:10:28 2011 UTC

9 9
10our $VERSION = $IO::AIO::VERSION; 10our $VERSION = $IO::AIO::VERSION;
11 11
12Getopt::Long::Configure ("bundling", "no_ignore_case", "require_order", "auto_help", "auto_version"); 12Getopt::Long::Configure ("bundling", "no_ignore_case", "require_order", "auto_help", "auto_version");
13 13
14my ($opt_silent, $opt_print0, $opt_stat, $opt_nodirs, $opt_nofiles); 14my ($opt_silent, $opt_print0, $opt_stat, $opt_nodirs, $opt_nofiles, $opt_grep);
15 15
16GetOptions 16GetOptions
17 "quiet|q" => \$opt_silent, 17 "quiet|q" => \$opt_silent,
18 "print0|0" => \$opt_print0, 18 "print0|0" => \$opt_print0,
19 "stat|s" => \$opt_stat, 19 "stat|s" => \$opt_stat,
20 "dirs|d" => \$opt_nofiles, 20 "dirs|d" => \$opt_nofiles,
21 "files|f" => \$opt_nodirs, 21 "files|f" => \$opt_nodirs,
22 "grep|g=s" => \$opt_grep,
22 or die "Usage: try $0 --help"; 23 or die "Usage: try $0 --help";
23 24
24@ARGV = "." unless @ARGV; 25@ARGV = "." unless @ARGV;
25 26
27$opt_grep &&= qr{$opt_grep}s;
28
26sub printfn { 29sub printfn {
27 my ($prefix, $files, $suffix) = @_; 30 my ($prefix, $files, $suffix) = @_;
28 31
32 if ($opt_grep) {
33 @$files = grep "$prefix$_" =~ $opt_grep, @$files;
34 }
35
29 if ($opt_print0) { 36 if ($opt_print0) {
30 print map "$prefix$_$suffix\0", @$files; 37 print map "$prefix$_$suffix\0", @$files;
31 } elsif (!$opt_silent) { 38 } elsif (!$opt_silent) {
32 print map "$prefix$_$suffix\n", @$files; 39 print map "$prefix$_$suffix\n", @$files;
33 } 40 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines