[Midnightbsd-cvs] src [10784] trunk/usr.bin/who/who.c: sync
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jun 9 22:47:16 EDT 2018
Revision: 10784
http://svnweb.midnightbsd.org/src/?rev=10784
Author: laffer1
Date: 2018-06-09 22:47:16 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
sync
Modified Paths:
--------------
trunk/usr.bin/who/Makefile
trunk/usr.bin/who/who.1
trunk/usr.bin/who/who.c
Property Changed:
----------------
trunk/usr.bin/who/who.1
Modified: trunk/usr.bin/who/Makefile
===================================================================
--- trunk/usr.bin/who/Makefile 2018-06-10 02:46:52 UTC (rev 10783)
+++ trunk/usr.bin/who/Makefile 2018-06-10 02:47:16 UTC (rev 10784)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/who/Makefile 202200 2010-01-13 18:09:54Z ed $
PROG= who
Modified: trunk/usr.bin/who/who.1
===================================================================
--- trunk/usr.bin/who/who.1 2018-06-10 02:46:52 UTC (rev 10783)
+++ trunk/usr.bin/who/who.1 2018-06-10 02:47:16 UTC (rev 10784)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1986, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -26,9 +27,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)who.1 8.2 (Berkeley) 12/30/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/who/who.1 241331 2012-10-07 20:01:41Z joel $
.\"
-.Dd May 8, 2002
+.Dd February 11, 2012
.Dt WHO 1
.Os
.Sh NAME
@@ -36,7 +37,7 @@
.Nd display who is on the system
.Sh SYNOPSIS
.Nm
-.Op Fl HmqsTu
+.Op Fl abHmqsTu
.Op Cm am I
.Op Ar file
.Sh DESCRIPTION
@@ -48,6 +49,13 @@
.Pp
The options are as follows:
.Bl -tag -width indent
+.It Fl a
+Equivalent to
+.Fl bTu ,
+with the exception that output is not restricted to the time and date of
+the last system reboot.
+.It Fl b
+Write the time and date of the last system reboot.
.It Fl H
Write column headings above the output.
.It Fl m
Property changes on: trunk/usr.bin/who/who.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/who/who.c
===================================================================
--- trunk/usr.bin/who/who.c 2018-06-10 02:46:52 UTC (rev 10783)
+++ trunk/usr.bin/who/who.c 2018-06-10 02:47:16 UTC (rev 10784)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
@@ -25,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/who/who.c 231537 2012-02-11 21:50:44Z ed $");
#include <sys/param.h>
#include <sys/types.h>
@@ -50,12 +51,14 @@
static void heading(void);
static void process_utmp(void);
static void quick(void);
-static void row(struct utmpx *);
+static void row(const struct utmpx *);
static int ttywidth(void);
static void usage(void);
static void whoami(void);
static int Hflag; /* Write column headings */
+static int aflag; /* Print all entries */
+static int bflag; /* Show date of the last reboot */
static int mflag; /* Show info about current terminal */
static int qflag; /* "Quick" mode */
static int sflag; /* Show name, line, time */
@@ -69,7 +72,7 @@
setlocale(LC_TIME, "");
- while ((ch = getopt(argc, argv, "HTmqsu")) != -1) {
+ while ((ch = getopt(argc, argv, "HTabmqsu")) != -1) {
switch (ch) {
case 'H': /* Write column headings */
Hflag = 1;
@@ -77,6 +80,12 @@
case 'T': /* Show terminal state */
Tflag = 1;
break;
+ case 'a': /* Same as -bdlprtTu */
+ aflag = bflag = Tflag = uflag = 1;
+ break;
+ case 'b': /* Show date of the last reboot */
+ bflag = 1;
+ break;
case 'm': /* Show info about current terminal */
mflag = 1;
break;
@@ -134,7 +143,7 @@
usage(void)
{
- fprintf(stderr, "usage: who [-HmqsTu] [am I] [file]\n");
+ fprintf(stderr, "usage: who [-abHmqsTu] [am I] [file]\n");
exit(1);
}
@@ -145,7 +154,7 @@
printf("%-16s ", "NAME");
if (Tflag)
printf("S ");
- printf("%-8s %-12s ", "LINE", "TIME");
+ printf("%-12s %-12s ", "LINE", "TIME");
if (uflag)
printf("IDLE ");
printf("%-16s\n", "FROM");
@@ -152,7 +161,7 @@
}
static void
-row(struct utmpx *ut)
+row(const struct utmpx *ut)
{
char buf[80], tty[PATH_MAX];
struct stat sb;
@@ -178,7 +187,10 @@
printf("%-16s ", ut->ut_user);
if (Tflag)
printf("%c ", state);
- printf("%-8s ", ut->ut_line);
+ if (ut->ut_type == BOOT_TIME)
+ printf("%-12s ", "system boot");
+ else
+ printf("%-12s ", ut->ut_line);
t = ut->ut_tv.tv_sec;
tm = localtime(&t);
strftime(buf, sizeof(buf), d_first ? "%e %b %R" : "%b %e %R", tm);
@@ -216,11 +228,10 @@
struct utmpx *utx;
while ((utx = getutxent()) != NULL) {
- if (utx->ut_type != USER_PROCESS)
- continue;
- if (ttystat(utx->ut_line) != 0)
- continue;
- row(utx);
+ if (((aflag || !bflag) && utx->ut_type == USER_PROCESS) ||
+ (bflag && utx->ut_type == BOOT_TIME))
+ if (ttystat(utx->ut_line) == 0)
+ row(utx);
}
}
More information about the Midnightbsd-cvs
mailing list