From 774a5e5d67ad4f93351e802d050293f82e2feafc Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Mon, 23 May 2016 01:04:47 +0200 Subject: [PATCH] tracefile: add --dir. --- Makefile | 1 - tracefile/tracefile | 31 ++++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 18e36c3..a6ebeca 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ all: blink/blink.1 goodpasswd/goodpasswd.1 histogram/histogram.1 rand/rand.1 rrm %.1: % pod2man $< > $@ - install: 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 diff --git a/tracefile/tracefile b/tracefile/tracefile index fdb026f..b57e72c 100755 --- a/tracefile/tracefile +++ b/tracefile/tracefile @@ -6,9 +6,9 @@ tracefile - list files being accessed =head1 SYNOPSIS -B [-aenu] I +B [-adenu] I -B [-aenu] -p I +B [-adenu] -p I =head1 DESCRIPTION @@ -16,7 +16,7 @@ B will print the files being accessed by the command. =head1 OPTIONS -=over 9 +=over 12 =item I @@ -25,25 +25,43 @@ Command to run. =item B<-a> +=item B<--all> + List all files. +=item B<-d> + +=item B<--dir> + +List only dirs. + + =item B<-e> +=item B<--exist> + List only existing files. =item B<-n> +=item B<--nonexist> + List only non-existing files. + =item B<-p> I +=item B<--pid> I + Trace process id. =item B<-u> +=item B<--unique> + List only files once. =back @@ -72,7 +90,7 @@ Report bugs to . =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. @@ -202,7 +220,7 @@ $Global::progname = "tracefile"; Getopt::Long::Configure("bundling","pass_through"); 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; } @@ -227,6 +245,8 @@ while() { or ($opt::exists and -e $file) or + ($opt::dir and -d $file) + or ($opt::nonexists and not -e $file)) { $print = 1; } @@ -241,6 +261,7 @@ sub options_hash { # Returns a hash of the GetOptions config return ("debug|D" => \$opt::debug, + "dir|d" => \$opt::dir, "uniq|unique|u" => \$opt::unique, "exists|exist|e" => \$opt::exists, "nonexists|nonexist|non-exists|non-exist|n" => \$opt::nonexists,