aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2010-07-19 02:26:59 +0000
committerAlexander Motin <mav@FreeBSD.org>2010-07-19 02:26:59 +0000
commitf91b7a2526b0583a84629ff8e0a724626f1b139a (patch)
tree6daa1d2ca33b3b058150048305e61e1ad69c6c4c
parent6ec1ef63d14bfb38faf1e787e825e8cc5b505797 (diff)
downloadsrc-f91b7a2526b0583a84629ff8e0a724626f1b139a.tar.gz
src-f91b7a2526b0583a84629ff8e0a724626f1b139a.zip
Partially revert r209312, restoring ability to fit "stray irqX" names into
into available 10 characters by dropping "irq" in the middle of string.
Notes
Notes: svn path=/head/; revision=210228
-rw-r--r--usr.bin/systat/vmstat.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 2985403c0c64..f5e832468897 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -259,18 +259,22 @@ initkre(void)
cp1 = cp1 + 2;
cp2 = strdup(cp);
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) {
+ 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;
}