From owner-freebsd-bugs@FreeBSD.ORG Thu Jun 10 20:50:03 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A83811065672 for ; Thu, 10 Jun 2010 20:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (unknown [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7E25B8FC0A for ; Thu, 10 Jun 2010 20:50:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o5AKo3OV062591 for ; Thu, 10 Jun 2010 20:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o5AKo3he062590; Thu, 10 Jun 2010 20:50:03 GMT (envelope-from gnats) Date: Thu, 10 Jun 2010 20:50:03 GMT Message-Id: <201006102050.o5AKo3he062590@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Eitan Adler Cc: Subject: Re: bin/143558: [patch] Add verbose option to pkill(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eitan Adler List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2010 20:50:03 -0000 The following reply was made to PR bin/143558; it has been noted by GNATS. From: Eitan Adler To: bug-followup@freebsd.org, eitanadlerlist@gmail.com Cc: Subject: Re: bin/143558: [patch] Add verbose option to pkill(1) Date: Thu, 10 Jun 2010 23:43:05 +0300 Changing stdout to stderr..... Index: pkill.1 =================================================================== --- pkill.1 (revision 208656) +++ pkill.1 (working copy) @@ -168,9 +168,9 @@ If used in conjunction with .Fl f , print the process ID and the full argument list for each matching process. -This option can only be used with the -.Nm pgrep -command. +If used in conjunction with the +.Nm pkill +command, it lists the signal sent as well. .It Fl n Select only the newest (most recently started) of the matching processes. .It Fl o Index: pkill.c =================================================================== --- pkill.c (revision 208656) +++ pkill.c (working copy) @@ -246,8 +246,6 @@ criteria = 1; break; case 'l': - if (!pgrep) - usage(); longfmt = 1; break; case 'n': @@ -529,16 +527,26 @@ /* * Take the appropriate action for each matched process, if any. */ + int didAction = 0; for (i = 0, rv = 0, kp = plist; i < nproc; i++, kp++) { if (PSKIP(kp)) continue; if (selected[i]) { + if (longfmt && !pgrep) + { + didAction = 1; + printf("kill -%d %d\n",signum,kp->ki_pid); + } if (inverse) continue; } else if (!inverse) continue; rv |= (*action)(kp); } + if (!didAction && !pgrep && longfmt) + { + fprintf(stderr,"No matching processes belonging to you were found\n"); + } exit(rv ? STATUS_MATCH : STATUS_NOMATCH); } @@ -551,7 +559,7 @@ if (pgrep) ustr = "[-LSfilnovx] [-d delim]"; else - ustr = "[-signal] [-ILfinovx]"; + ustr = "[-signal] [-ILfilnovx]"; fprintf(stderr, "usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n" -- Eitan Adler