summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-10-20 20:13:50 +0000
committerphk <phk@FreeBSD.org>2003-10-20 20:13:50 +0000
commit9d8ec418a723bc3eabfaece1b5414eaa794f3224 (patch)
tree853dac80e623874e270b11c69237236940a738bc /usr.bin
parentd477fdf956008182b20cd96c718f3410a088597b (diff)
downloadFreeBSD-src-9d8ec418a723bc3eabfaece1b5414eaa794f3224.zip
FreeBSD-src-9d8ec418a723bc3eabfaece1b5414eaa794f3224.tar.gz
When a numeric field overflows its width, try formatting the number in
'kilo' or 'mega' with appropriate suffix instead of filling the field with stars.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/systat/devs.c2
-rw-r--r--usr.bin/systat/vmstat.c9
2 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c
index 309253e..d37cf2d 100644
--- a/usr.bin/systat/devs.c
+++ b/usr.bin/systat/devs.c
@@ -138,7 +138,7 @@ dsinit(int maxshowdevs, struct statinfo *s1, struct statinfo *s2 __unused,
if (devstat_selectdevs(&dev_select, &num_selected, &num_selections,
&select_generation, generation, s1->dinfo->devices, num_devices,
NULL, 0, NULL, 0, DS_SELECT_ADD, maxshowdevs, 0) == -1)
- errx(1, "%s", devstat_errbuf);
+ errx(1, "%d %s", __LINE__, devstat_errbuf);
return(1);
}
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 92a5e83..6a11f46 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -678,11 +678,10 @@ putint(n, l, lc, w)
return;
}
snprintf(b, sizeof(b), "%*d", w, n);
- if ((int)strlen(b) > w) {
- while (w-- > 0)
- addch('*');
- return;
- }
+ if ((int)strlen(b) > w)
+ snprintf(b, sizeof(b), "%*dK", w - 1, n / 1000);
+ if ((int)strlen(b) > w)
+ snprintf(b, sizeof(b), "%*dM", w - 1, n / 1000000);
addstr(b);
}
OpenPOWER on IntegriCloud