Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 2010 17:43:32 +0200
From:      Eitan Adler <eitanadlerlist@gmail.com>
To:        hackers@freebsd.org
Subject:   [patch] pkill verbose option
Message-ID:  <a0777e081002010743w51a3486ayd562710411c64713@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a0777e081002010743w51a3486ayd562710411c64713>