svn commit: r359796 - stable/12/usr.bin/ruptime

Takahashi Yoshihiro nyan at FreeBSD.org
Sat Apr 11 07:31:17 UTC 2020


Author: nyan
Date: Sat Apr 11 07:31:16 2020
New Revision: 359796
URL: https://svnweb.freebsd.org/changeset/base/359796

Log:
  MFC: r359631
  
  Remove extra spaces for the load average of machines that are down.
  
  PR:		245296
  Submitted by:	martin _at_ lispworks.com

Modified:
  stable/12/usr.bin/ruptime/ruptime.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/ruptime/ruptime.c
==============================================================================
--- stable/12/usr.bin/ruptime/ruptime.c	Sat Apr 11 07:24:57 2020	(r359795)
+++ stable/12/usr.bin/ruptime/ruptime.c	Sat Apr 11 07:31:16 2020	(r359796)
@@ -234,18 +234,21 @@ ruptime(const char *host, int aflg, int (*cmp)(const v
 
 		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;
 	}


More information about the svn-src-stable-12 mailing list