aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/ruptime
diff options
context:
space:
mode:
authorYoshihiro Takahashi <nyan@FreeBSD.org>2020-04-04 12:07:36 +0000
committerYoshihiro Takahashi <nyan@FreeBSD.org>2020-04-04 12:07:36 +0000
commitba2c1f62af897b0a1ec8042c8120dbf019b79959 (patch)
tree4e7ad6ba5e271d4341abaa355fb07d74493aa7e9 /usr.bin/ruptime
parentd2034aedc1d28ea7495b2ee3f7dcc946ef5fb308 (diff)
downloadsrc-ba2c1f62af897b0a1ec8042c8120dbf019b79959.tar.gz
src-ba2c1f62af897b0a1ec8042c8120dbf019b79959.zip
Remove extra spaces for the load average of machines that are down.
PR: 245296 Submitted by: martin _at_ lispworks.com MFC after: 1 week
Notes
Notes: svn path=/head/; revision=359631
Diffstat (limited to 'usr.bin/ruptime')
-rw-r--r--usr.bin/ruptime/ruptime.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/ruptime/ruptime.c b/usr.bin/ruptime/ruptime.c
index 9d16c3efa49b..62a771b02d39 100644
--- a/usr.bin/ruptime/ruptime.c
+++ b/usr.bin/ruptime/ruptime.c
@@ -234,18 +234,21 @@ ruptime(const char *host, int aflg, int (*cmp)(const void *, const void *))
if (hostnamewidth < (int)strlen(wd->wd_hostname))
hostnamewidth = (int)strlen(wd->wd_hostname);
- for (i = 0; i < 3; i++) {
- w = iwidth(wd->wd_loadav[i] / 100) + 3;
- if (loadavwidth[i] < w)
- loadavwidth[i] = w;
+
+ if (!ISDOWN(hsp)) {
+ for (i = 0; i < 3; i++) {
+ w = iwidth(wd->wd_loadav[i] / 100) + 3;
+ if (loadavwidth[i] < w)
+ loadavwidth[i] = w;
+ }
+ for (hsp->hs_nusers = 0, we = &wd->wd_we[0];
+ (char *)(we + 1) <= (char *)wd + cc; we++)
+ if (aflg || we->we_idle < 3600)
+ ++hsp->hs_nusers;
+ if (userswidth < iwidth(hsp->hs_nusers))
+ userswidth = iwidth(hsp->hs_nusers);
}
- for (hsp->hs_nusers = 0, we = &wd->wd_we[0];
- (char *)(we + 1) <= (char *)wd + cc; we++)
- if (aflg || we->we_idle < 3600)
- ++hsp->hs_nusers;
- if (userswidth < iwidth(hsp->hs_nusers))
- userswidth = iwidth(hsp->hs_nusers);
++hsp;
++nhosts;
}