diff options
author | mav <mav@FreeBSD.org> | 2010-06-18 18:18:03 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2010-06-18 18:18:03 +0000 |
commit | a2f18e904a958b0acbb9a81dcad9e154c2a0b401 (patch) | |
tree | afeb8c151362fd6b40f176d8dba3cb0deb8f5470 /usr.bin/systat | |
parent | b877c685c2a54e557c957f3912b545c342fe0885 (diff) | |
download | FreeBSD-src-a2f18e904a958b0acbb9a81dcad9e154c2a0b401.zip FreeBSD-src-a2f18e904a958b0acbb9a81dcad9e154c2a0b401.tar.gz |
Do not print first digits of IRQ number if whole number doesn't fit.
Diffstat (limited to 'usr.bin/systat')
-rw-r--r-- | usr.bin/systat/vmstat.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 1a02197..2985403 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -254,24 +254,23 @@ initkre(void) cp1++; if (cp1 != cp && *cp1 == ':' && *(cp1 + 1) == ' ') { + sz = strlen(cp); *cp1 = '\0'; cp1 = cp1 + 2; cp2 = strdup(cp); - bcopy(cp1, cp, strlen(cp1) + 1); - strcat(cp, " "); - strcat(cp, cp2); + bcopy(cp1, cp, sz - (cp1 - cp) + 1); + /* If line is long - drop "irq", + if too long - drop "irqN". */ + if (sz <= 10 + 1) { + strcat(cp, " "); + strcat(cp, cp2); + } else if (sz <= 10 + 4) { + strcat(cp, " "); + strcat(cp, cp2 + 3); + } free(cp2); } } - - /* - * Convert "name irqN" to "name N" if the former is - * longer than the field width. - */ - if ((cp1 = strstr(cp, "irq")) != NULL && - strlen(cp) > 10) - bcopy(cp1 + 3, cp1, strlen(cp1 + 3) + 1); - intrname[i] = cp; cp = nextcp; } |