From owner-freebsd-bugs@freebsd.org Sat May 6 23:47:10 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88D78D6159F for ; Sat, 6 May 2017 23:47:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65C3D9F5 for ; Sat, 6 May 2017 23:47:10 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v46NlA18052072 for ; Sat, 6 May 2017 23:47:10 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 219113] [feature request][patch] Make ruptime(1) more specific about number of users Date: Sat, 06 May 2017 23:47:10 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-STABLE X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: andyf@andyit.com.au X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status keywords bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 23:47:10 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D219113 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@FreeBSD.org Reporter: andyf@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 =3D=3D 1 ? ", " : "s,", maxloadav >=3D 1000 ? 5 : 4, wd->wd_loadav[0] / 100.0, which produces an output like this: andyf@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@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@deepthink:~ %=20 (note: I've deleted 8 spaces from the first column to stop line-wrap) --=20 You are receiving this mail because: You are the assignee for the bug.=