[patch] pkill verbose option
Eitan Adler
eitanadlerlist at gmail.com
Mon Feb 1 16:05:36 UTC 2010
Here is a patch that adds a -V option which prints out what PIDs it is
taking action on.
Index: pkill.c
===================================================================
--- pkill.c (revision 203347)
+++ pkill.c (working copy)
@@ -105,6 +105,7 @@
static int oldest;
static int interactive;
static int inverse;
+static int flagPrint = 0;
static int longfmt;
static int matchargs;
static int fullmatch;
@@ -182,7 +183,7 @@
pidfilelock = 0;
execf = coref = _PATH_DEVNULL;
- while ((ch = getopt(argc, argv,
"DF:G:ILM:N:P:SU:ad:fg:ij:lnos:t:u:vx")) != -1)
+ while ((ch = getopt(argc, argv,
"DF:G:ILM:N:P:SU:Vad:fg:ij:lnos:t:u:vx")) != -1)
switch (ch) {
case 'D':
debug_opt++;
@@ -272,6 +273,9 @@
case 'v':
inverse = 1;
break;
+ case 'V':
+ flagPrint = 1;
+ break;
case 'x':
fullmatch = 1;
break;
@@ -532,6 +536,10 @@
if (PSKIP(kp))
continue;
if (selected[i]) {
+ if (flagPrint)
+ {
+ printf("%d\n",kp->ki_pid);
+ }
if (inverse)
continue;
} else if (!inverse)
More information about the freebsd-hackers
mailing list