bin/143558: [patch] Add verbose option to pkill(1)

Eitan Adler eitanadlerlist at gmail.com
Wed Mar 3 11:20:03 UTC 2010


The following reply was made to PR bin/143558; it has been noted by GNATS.

From: Eitan Adler <eitanadlerlist at gmail.com>
To: bug-followup at freebsd.org, eitanadlerlist at gmail.com
Cc:  
Subject: Re: bin/143558: [patch] Add verbose option to pkill(1)
Date: Wed, 3 Mar 2010 13:12:59 +0200

 Two updates
 1) remove useless change to getopt parameters
 2) pgrep -l no longer prints out extra kill information
 
 Index: pkill.1
 ===================================================================
 --- pkill.1	(revision 203347)
 +++ 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 203347)
 +++ pkill.c	(working copy)
 @@ -245,8 +245,6 @@
  			criteria = 1;
  			break;
  		case 'l':
 -			if (!pgrep)
 -				usage();
  			longfmt = 1;
  			break;
  		case 'n':
 @@ -528,16 +526,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)
 +	{
 +		printf("No matching processes belonging to you were found\n");
 +	}
 
  	exit(rv ? STATUS_MATCH : STATUS_NOMATCH);
  }
 @@ -550,7 +558,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"


More information about the freebsd-bugs mailing list