diff options
author | jhb <jhb@FreeBSD.org> | 2000-11-29 23:03:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-11-29 23:03:02 +0000 |
commit | ab339e890582e9091c333d4323084c43e7f1132c (patch) | |
tree | 464202657042507a1390f4082afc011cecc43fe6 /usr.bin/top/machine.c | |
parent | 1eedb5d634433ede0cf7ce79ad02c1b6de41f4ca (diff) | |
download | FreeBSD-src-ab339e890582e9091c333d4323084c43e7f1132c.zip FreeBSD-src-ab339e890582e9091c333d4323084c43e7f1132c.tar.gz |
Make use of the full screen width to display p_comm rather than assuming a
hardcoded screen width of 80 chars.
Diffstat (limited to 'usr.bin/top/machine.c')
-rw-r--r-- | usr.bin/top/machine.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index e5526bf..7988183 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -53,6 +53,7 @@ #include "top.h" #include "machine.h" +#include "screen.h" static int check_nlist __P((struct nlist *)); static int getkval __P((unsigned long, int *, int, char *)); @@ -60,7 +61,7 @@ extern char* printable __P((char *)); int swapmode __P((int *retavail, int *retfree)); static int smpmode; static int namelength; -static int cmdlength; +static int cmdlengthdelta; /* get_process_info passes back a handle. This is what it looks like: */ @@ -315,7 +316,7 @@ register char *uname_field; snprintf(Header, sizeof(Header), smpmode ? smp_header : up_header, namelength, namelength, uname_field); - cmdlength = 80 - strlen(Header) + 6; + cmdlengthdelta = strlen(Header) - 7; return Header; } @@ -634,7 +635,9 @@ char *(*get_userid)(); format_time(cputime), 100.0 * weighted_cpu(pct, pp), 100.0 * pct, - cmdlength, + screen_width > cmdlengthdelta ? + screen_width - cmdlengthdelta : + 0, printable(PP(pp, p_comm))); /* return the result */ |