Commit 774a5e5d authored by Ole Tange's avatar Ole Tange
Browse files

tracefile: add --dir.

parent 96f2c1c2
...@@ -5,7 +5,6 @@ all: blink/blink.1 goodpasswd/goodpasswd.1 histogram/histogram.1 rand/rand.1 rrm ...@@ -5,7 +5,6 @@ all: blink/blink.1 goodpasswd/goodpasswd.1 histogram/histogram.1 rand/rand.1 rrm
%.1: % %.1: %
pod2man $< > $@ pod2man $< > $@
install: install:
mkdir -p /usr/local/bin mkdir -p /usr/local/bin
parallel eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram goodpasswd mtrr not summer timestamp transpose wssh aptsearch rand rrm parallel eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram goodpasswd mtrr not summer timestamp transpose wssh aptsearch rand rrm
......
...@@ -6,9 +6,9 @@ tracefile - list files being accessed ...@@ -6,9 +6,9 @@ tracefile - list files being accessed
=head1 SYNOPSIS =head1 SYNOPSIS
B<tracefile> [-aenu] I<command> B<tracefile> [-adenu] I<command>
B<tracefile> [-aenu] -p I<pid> B<tracefile> [-adenu] -p I<pid>
=head1 DESCRIPTION =head1 DESCRIPTION
...@@ -16,7 +16,7 @@ B<tracefile> will print the files being accessed by the command. ...@@ -16,7 +16,7 @@ B<tracefile> will print the files being accessed by the command.
=head1 OPTIONS =head1 OPTIONS
=over 9 =over 12
=item I<command> =item I<command>
...@@ -25,25 +25,43 @@ Command to run. ...@@ -25,25 +25,43 @@ Command to run.
=item B<-a> =item B<-a>
=item B<--all>
List all files. List all files.
=item B<-d>
=item B<--dir>
List only dirs.
=item B<-e> =item B<-e>
=item B<--exist>
List only existing files. List only existing files.
=item B<-n> =item B<-n>
=item B<--nonexist>
List only non-existing files. List only non-existing files.
=item B<-p> I<pid> =item B<-p> I<pid>
=item B<--pid> I<pid>
Trace process id. Trace process id.
=item B<-u> =item B<-u>
=item B<--unique>
List only files once. List only files once.
=back =back
...@@ -72,7 +90,7 @@ Report bugs to <tange@gnu.org>. ...@@ -72,7 +90,7 @@ Report bugs to <tange@gnu.org>.
=head1 AUTHOR =head1 AUTHOR
Copyright (C) 2012 Ole Tange, http://ole.tange.dk and Free Copyright (C) 2012,2016 Ole Tange, http://ole.tange.dk and Free
Software Foundation, Inc. Software Foundation, Inc.
...@@ -202,7 +220,7 @@ $Global::progname = "tracefile"; ...@@ -202,7 +220,7 @@ $Global::progname = "tracefile";
Getopt::Long::Configure("bundling","pass_through"); Getopt::Long::Configure("bundling","pass_through");
get_options_from_array(\@ARGV) || die_usage(); get_options_from_array(\@ARGV) || die_usage();
if(not ($opt::exists or $opt::nonexists or $opt::all)) { if(not ($opt::exists or $opt::nonexists or $opt::all or $opt::dir)) {
$opt::all = 1; $opt::all = 1;
} }
...@@ -227,6 +245,8 @@ while(<IN>) { ...@@ -227,6 +245,8 @@ while(<IN>) {
or or
($opt::exists and -e $file) ($opt::exists and -e $file)
or or
($opt::dir and -d $file)
or
($opt::nonexists and not -e $file)) { ($opt::nonexists and not -e $file)) {
$print = 1; $print = 1;
} }
...@@ -241,6 +261,7 @@ sub options_hash { ...@@ -241,6 +261,7 @@ sub options_hash {
# Returns a hash of the GetOptions config # Returns a hash of the GetOptions config
return return
("debug|D" => \$opt::debug, ("debug|D" => \$opt::debug,
"dir|d" => \$opt::dir,
"uniq|unique|u" => \$opt::unique, "uniq|unique|u" => \$opt::unique,
"exists|exist|e" => \$opt::exists, "exists|exist|e" => \$opt::exists,
"nonexists|nonexist|non-exists|non-exist|n" => \$opt::nonexists, "nonexists|nonexist|non-exists|non-exist|n" => \$opt::nonexists,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment