From 4d48ed75234929cd641960066c0d1b85bbd82636 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Sun, 8 Jun 1997 01:52:33 +0000 Subject: (ps_emit_wait): Provide slightly better abbreviations for various port types. --- libps/spec.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'libps/spec.c') diff --git a/libps/spec.c b/libps/spec.c index 017abf1b..779444ed 100644 --- a/libps/spec.c +++ b/libps/spec.c @@ -1,6 +1,6 @@ /* Access, formatting, & comparison routines for printing process info. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Written by Miles Bader @@ -742,14 +742,19 @@ ps_emit_wait (struct proc_stat *ps, struct ps_fmt_field *field, else if (strcmp (wait, "init#5") == 0) wait = "boot"; /* Bootstrap port */ else - /* See if we can shorten the name to fit better. We happen know that - all currently returned keys are unique in the first character. */ + /* See if we can shorten the name to fit better. */ { - char *sep = index (wait, '#'); - if (sep && sep > wait) + char *abbrev = 0, *num = 0; + if (strncmp (wait, "fd#", 3) == 0) + abbrev = "fd", num = wait + 3; + else if (strncmp (wait, "bgfd#", 5) == 0) + abbrev = "bg", num = wait + 5; + else if (strncmp (wait, "port#", 5) == 0) + abbrev = "", num = wait + 5; + if (abbrev) { snprintf (port_name_buf, sizeof port_name_buf, - "%c%s", wait[0], sep); + "%s%s", abbrev, num); wait = port_name_buf; } } -- cgit v1.2.3