summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-10-21 07:30:26 +0000
committerpeter <peter@FreeBSD.org>1996-10-21 07:30:26 +0000
commit8fd01a136e847689c60d19cd8d439b37c9a7b5a9 (patch)
tree6da5843225e613b5eb4f4456c650f4b7576cd2de /bin/ps/print.c
parent0392fde42645c8d1db15c97f3b45d1faa9f96b1c (diff)
downloadFreeBSD-src-8fd01a136e847689c60d19cd8d439b37c9a7b5a9.zip
FreeBSD-src-8fd01a136e847689c60d19cd8d439b37c9a7b5a9.tar.gz
Implement a -c option to ps to display the short command name instead of
the full argument vector. I've bumped into a few things that expected this switch to be present, the most recent was the snmp package in ports. I'm not 100% sure of the origins of this, but Linux has it, so does the "BSD-compatable" version of ps on our SVR4 systems (so I assume SunOS has it too).
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 5c01f30..0d5a09f 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: print.c,v 1.14 1996/06/29 08:04:05 peter Exp $
+ * $Id: print.c,v 1.15 1996/06/29 10:25:31 peter Exp $
*/
#ifndef lint
@@ -100,6 +100,13 @@ command(k, ve)
int left;
char *cp, *vis_env, *vis_args;
+ v = ve->var;
+
+ if (cflag) {
+ (void)printf("%-*s", v->width, KI_PROC(k)->p_comm);
+ return;
+ }
+
if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL)
err(1, NULL);
strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH);
@@ -110,7 +117,6 @@ command(k, ve)
} else
vis_env = NULL;
- v = ve->var;
if (ve->next == NULL) {
/* last field */
if (termwidth == UNLIMITED) {
OpenPOWER on IntegriCloud