summaryrefslogtreecommitdiff
path: root/usr.bin/vmstat/vmstat.c
diff options
context:
space:
mode:
authorKenneth D. Merry <ken@FreeBSD.org>1999-02-10 00:46:27 +0000
committerKenneth D. Merry <ken@FreeBSD.org>1999-02-10 00:46:27 +0000
commit4faf42f3ae1a331ce2e108f88c78a2902bea99cc (patch)
treec4a40115729fc095bf17c39704455d99b807f14b /usr.bin/vmstat/vmstat.c
parent0f1eaab82c8830bfcd1190150ebe4c000a0fc568 (diff)
Notes
Diffstat (limited to 'usr.bin/vmstat/vmstat.c')
-rw-r--r--usr.bin/vmstat/vmstat.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 067d6d7d3fa0..d2b77b50f824 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -189,7 +189,7 @@ main(argc, argv)
memf = nlistf = NULL;
interval = reps = todo = 0;
- maxshowdevs = 3;
+ maxshowdevs = 2;
while ((c = getopt(argc, argv, "c:fiM:mN:n:p:stw:")) != -1) {
switch (c) {
case 'c':
@@ -539,18 +539,15 @@ dovmstat(interval, reps)
void
printhdr()
{
- register int i;
+ int i, num_shown;
+ num_shown = (num_selected < maxshowdevs) ? num_selected : maxshowdevs;
(void)printf(" procs memory page%*s", 19, "");
- if (num_selected > 1)
- (void)printf("disks %*s faults cpu\n",
- ((num_selected < maxshowdevs) ? num_selected :
- maxshowdevs ) * 4 - 7, "");
- else if (num_selected == 1)
- (void)printf("disk faults cpu\n");
- else
- (void)printf("%*s faults cpu\n", num_selected * 4, "");
-
+ if (num_shown > 1)
+ (void)printf(" disks %*s", num_shown * 4 - 7, "");
+ else if (num_shown == 1)
+ (void)printf("disk");
+ (void)printf(" faults cpu\n");
(void)printf(" r b w avm fre flt re pi po fr sr ");
for (i = 0; i < num_devices; i++)
if ((dev_select[i].selected)