X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/be0e2d2358942ea1f2921bb8bd441f63722764e5..ed0072ae24fddb69a3be103d32f9038547f18c85:/usr/src/usr.bin/ruptime/ruptime.c diff --git a/usr/src/usr.bin/ruptime/ruptime.c b/usr/src/usr.bin/ruptime/ruptime.c index e11713d762..3945c5f4c4 100644 --- a/usr/src/usr.bin/ruptime/ruptime.c +++ b/usr/src/usr.bin/ruptime/ruptime.c @@ -1,10 +1,10 @@ #ifndef lint -static char sccsid[] = "@(#)ruptime.c 4.1 82/04/02"; +static char sccsid[] = "@(#)ruptime.c 4.4 82/05/09"; #endif -#include /* botch in ndir.h */ +#include #include -#include +#include #include #include "rwhod.h" @@ -36,6 +36,7 @@ main(argc, argv) register struct hs *hsp = hs; register struct whod *wd; register struct whoent *we; + int maxloadav = 0; time(&t); argc--, argv++; @@ -71,6 +72,9 @@ again: wd = (struct whod *)buf; bcopy(buf, hsp->hs_wd, WHDRSIZE); hsp->hs_nusers = 0; + for (i = 0; i < 2; i++) + if (wd->wd_loadav[i] > maxloadav) + maxloadav = wd->wd_loadav[i]; we = (struct whoent *)(buf+cc); while (--we >= wd->wd_we) if (aflg || we->we_idle < 3600) @@ -93,15 +97,18 @@ again: interval(now - hsp->hs_wd->wd_recvtime, "down")); continue; } - printf("%-8.8s%s, %4d user%s load %4.2f, %4.2f, %4.2f\n", + printf("%-8.8s%s, %4d user%s load %*.2f, %*.2f, %*.2f\n", hsp->hs_wd->wd_hostname, interval(hsp->hs_wd->wd_sendtime - hsp->hs_wd->wd_bootime, " up"), hsp->hs_nusers, hsp->hs_nusers == 1 ? ", " : "s,", - hsp->hs_wd->wd_loadav[0] / 100.0, - hsp->hs_wd->wd_loadav[1] / 100.0, - hsp->hs_wd->wd_loadav[2] / 100.0); + maxloadav >= 1000 ? 5 : 4, + hsp->hs_wd->wd_loadav[0] / 100.0, + maxloadav >= 1000 ? 5 : 4, + hsp->hs_wd->wd_loadav[1] / 100.0, + maxloadav >= 1000 ? 5 : 4, + hsp->hs_wd->wd_loadav[2] / 100.0); cfree(hsp->hs_wd); } exit(0);