diff options
author | Miles Bader <miles@gnu.org> | 1997-06-08 01:52:33 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-06-08 01:52:33 +0000 |
commit | 4d48ed75234929cd641960066c0d1b85bbd82636 (patch) | |
tree | b8b1384857ff2349e602c7a3df6c40b6f24e80b2 /libps | |
parent | e8cf6b606bc8b9e3b907d200fa68fd870bf84d6d (diff) |
(ps_emit_wait):
Provide slightly better abbreviations for various port types.
Diffstat (limited to 'libps')
-rw-r--r-- | libps/spec.c | 17 |
1 files changed, 11 insertions, 6 deletions
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 <miles@gnu.ai.mit.edu> @@ -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; } } |