[Bug 219113] [feature request][patch] Make ruptime(1) more specific about number of users
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat May 6 23:47:10 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219113
Bug ID: 219113
Summary: [feature request][patch] Make ruptime(1) more specific
about number of users
Product: Base System
Version: 11.0-STABLE
Hardware: Any
OS: Any
Status: New
Keywords: patch
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: andyf at andyit.com.au
Keywords: patch
I had to think twice and read the man page for ruptime(1) when it reported
0 users on machines I knew I was logged in to multiple times (see -a flag).
I propose the following simple patch:
--- /usr/src/usr.bin/ruptime/ruptime.c 2017-05-07 09:24:38.767786000 +1000
+++ ./ruptime.c 2016-12-11 09:39:26.693397000 +1000
@@ -242,11 +242,12 @@
continue;
}
(void)printf(
- "%-25.25s%s, %4d user%s load %*.2f, %*.2f, %*.2f\n",
+ "%-25.25s%s, %4d %suser%s load %*.2f, %*.2f, %*.2f\n",
wd->wd_hostname,
interval((time_t)wd->wd_sendtime -
(time_t)wd->wd_boottime, " up"),
hsp->hs_nusers,
+ aflg ? "" : "active ",
hsp->hs_nusers == 1 ? ", " : "s,",
maxloadav >= 1000 ? 5 : 4,
wd->wd_loadav[0] / 100.0,
which produces an output like this:
andyf at deepthink:~ % ruptime
deepthink up 36+16:20, 1 active user, load 0.20, 0.28, 0.44
drunkfish up 55+14:37, 3 active users, load 0.60, 0.26, 0.20
hummer up 42+23:15, 1 active user, load 0.11, 0.08, 0.05
snuggles up 131+15:26, 8 active users, load 0.20, 0.21, 0.17
andyf at deepthink:~ % ruptime -a
deepthink up 36+16:20, 3 users, load 0.20, 0.28, 0.44
drunkfish up 55+14:37, 8 users, load 0.60, 0.26, 0.20
hummer up 42+23:15, 2 users, load 0.11, 0.08, 0.05
snuggles up 131+15:26, 13 users, load 0.20, 0.21, 0.17
andyf at deepthink:~ %
(note: I've deleted 8 spaces from the first column to stop line-wrap)
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list