NetBSD Problem Report #148

From gnats  Wed Mar  2 08:38:24 1994
Received: from skarven.dsl.unit.no (skarven.dsl.unit.no [129.241.36.65]) by sun-lamp.cs.berkeley.edu (8.6.5/8.6.5) with ESMTP id IAA24314 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Wed, 2 Mar 1994 08:38:23 -0800
Message-Id: <199403021628.RAA14073@skarven.dsl.unit.no>
Date: Wed, 2 Mar 1994 17:28:25 +0100
From: arnej@dsl.unit.no
Reply-To: arnej@dsl.unit.no
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: ps -c option wanted
X-Send-Pr-Version: 3.2

>Number:         148
>Category:       bin
>Synopsis:       ps has no c option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 02 08:50:03 +0000 1994
>Closed-Date:    Fri Sep 16 22:23:42 +0000 1994
>Last-Modified:  
>Originator:     Arne Juul
>Release:        
>Organization:
University of Trondheim, Norway
>Environment:
	NetBSD-current last sup'ed Mar 1 1994
System: NetBSD skarven.dsl.unit.no 0.9a SKARVEN#0 i386


>Description:
	After several years of using BSD-derived systems, I have
	become accustomed to using "ps xgc" and other usages of
	the -c option. NetBSD currently does not implement any such
	option, giving only 'illegal option'. Having the option would
	be nice (but I imagine I could probably get used to it, so
	feel free to munge or junk this patch).
>How-To-Repeat:
	ps -c
>Fix:
	Apply this patch:
diff -rc /usr/src/bin/ps/ps.1 ./ps.1
*** /usr/src/bin/ps/ps.1	Tue Jan 11 11:21:59 1994
--- ./ps.1	Wed Mar  2 17:14:22 1994
***************
*** 40,46 ****
  .Nd process status
  .Sh SYNOPSIS
  .Nm \&ps
! .Op Fl aChjlmrSTuvwx
  .Op Fl M Ar core
  .Op Fl N Ar system
  .Op Fl O Ar fmt
--- 40,46 ----
  .Nd process status
  .Sh SYNOPSIS
  .Nm \&ps
! .Op Fl acChjlmrSTuvwx
  .Op Fl M Ar core
  .Op Fl N Ar system
  .Op Fl O Ar fmt
***************
*** 72,77 ****
--- 72,81 ----
  .Bl -tag -width indent
  .It Fl a
  Display information about other users' processes as well as your own.
+ .It Fl c
+ Do not display full command with arguments, but only the
+ executable name. This may be somewhat confusing - for example, all
+ shell scripts will show as 'sh'.
  .It Fl C
  Change the way the cpu percentage is calculated by using a ``raw''
  cpu calculation that ignores ``resident'' time (this normally has
diff -rc /usr/src/bin/ps/ps.c ./ps.c
*** /usr/src/bin/ps/ps.c	Fri Dec 17 06:48:01 1993
--- ./ps.c	Wed Mar  2 17:18:37 1994
***************
*** 73,79 ****
  int	termwidth;		/* width of screen (0 == infinity) */
  int	totwidth;		/* calculated width of requested variables */

! static int needuser, needcomm, needenv;

  enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;

--- 73,79 ----
  int	termwidth;		/* width of screen (0 == infinity) */
  int	totwidth;		/* calculated width of requested variables */

! static int needuser, needcomm, needenv, commandonly;

  enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;

***************
*** 128,138 ****
  	ttydev = NODEV;
  	memf = nlistf = swapf = NULL;
  	while ((ch = getopt(argc, argv,
! 	    "aCeghjLlM:mN:O:o:p:rSTt:uvW:wx")) != EOF)
  		switch((char)ch) {
  		case 'a':
  			all = 1;
  			break;
  		case 'C':
  			rawcpu = 1;
  			break;
--- 128,141 ----
  	ttydev = NODEV;
  	memf = nlistf = swapf = NULL;
  	while ((ch = getopt(argc, argv,
! 	    "acCeghjLlM:mN:O:o:p:rSTt:uvW:wx")) != EOF)
  		switch((char)ch) {
  		case 'a':
  			all = 1;
  			break;
+ 		case 'c':
+ 			commandonly = 1;
+ 			break;
  		case 'C':
  			rawcpu = 1;
  			break;
***************
*** 362,368 ****
  	/*
  	 * save arguments and environment if needed
  	 */
! 	ki->ki_args = needcomm ? strdup(kvm_getargs(ki->ki_p, up)) : NULL;
  	ki->ki_env = needenv ? strdup(kvm_getenv(ki->ki_p, up)) : NULL;

  	if (up != NULL) {
--- 365,379 ----
  	/*
  	 * save arguments and environment if needed
  	 */
! 	if (needcomm) {
! 		if (commandonly) {
! 			ki->ki_args = strdup(ki->ki_p->p_comm);
! 		} else {
! 			ki->ki_args = strdup(kvm_getargs(ki->ki_p, up));
! 		}
! 	} else {
! 		ki->ki_args = NULL;
! 	}
  	ki->ki_env = needenv ? strdup(kvm_getenv(ki->ki_p, up)) : NULL;

  	if (up != NULL) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Fri Sep 16 15:23:42 PDT 1994 
State-Changed-Why:  
Integrated. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.