Bring who up to snuff with rest of source tree

This commit is contained in:
taubert 1998-01-25 23:36:30 +00:00
parent 320f77f2b4
commit f53219715c
5 changed files with 101 additions and 69 deletions

View File

@ -1,7 +1,6 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $Id: Makefile,v 1.3 1998/01/25 23:36:25 taubert Exp $
PROG= who
.INCLUDEDIRS : ..
.INCLUDE : <bsd.prog.mk>
.INCLUDE: /src/gno/prog.mk

View File

@ -31,74 +31,75 @@
.\"
.\" @(#)who.1 8.2 (Berkeley) 12/30/93
.\"
.\" $Id: who.1,v 1.1 1997/10/26 17:12:24 gdr Exp $
.\"
.TH WHO 1 "26 October 1997" GNO "Commands and Applications"
.SH NAME
.BR who
\- display who is logged in
.SH SYNOPSIS
.BR who
.RB [ am
.BR I ]
.RI [ file ]
.SH DESCRIPTION
.Dd December 30, 1993
.Dt WHO 1
.Os
.Sh NAME
.Nm who
.Nd display who is logged in
.Sh SYNOPSIS
.Nm who
.Op Ar am I
.Op Ar file
.Sh DESCRIPTION
The utility
.BR who
.Nm who
displays
a list of all users currently logged on, showing for each user
the login name,
tty name, the date and time of login, and hostname if not local.
.LP
.Pp
Available options:
.RS
.IP "\fBam I\fR"
.Pp
.Bl -tag -width file
.It Ar \&am I
Returns the invoker's real user name.
.IP \fIfile\fR
.It Ar file
By default,
.BR who
.Nm who
gathers information from the file
.BR /var/run/utmp .
.Pa /var/run/utmp .
An alternate
.BR file
.Ar file
may be specified which is usually
.BR /var/run/wtmp
.Pa /var/run/wtmp
(or
.BR /var/run/wtmp.[0-6]
.Pa /var/run/wtmp.[0-6]
depending on site policy as
.BR wtmp
.Pa wtmp
can grow quite large and daily versions may or may not
be kept around after compression by
.BR ac (8)).
.Xr ac 8 ) .
The
.BR wtmp
.Pa wtmp
file contains a record of every login, logout,
crash, shutdown and date change
since
.BR wtmp
.Pa wtmp
was last truncated or
created.
.RE
.LP
.El
.Pp
If
.BR /var/log/wtmp
.Pa /var/log/wtmp
is being used as the file, the user name may be empty
or one of the special characters '|', '}' and '~'. Logouts produce
an output line without any user name. For more information on the
special characters, see
.BR utmp (5).
.SH FILES
.B /var/run/utmp
.br
.B /var/log/wtmp
.br
.B /var/log/wtmp.[0-6]
.SH SEE ALSO
.BR last (1),
.BR users (1),
.BR getuid (2),
.BR utmp (5)
.SH HISTORY
.Xr utmp 5 .
.Sh FILES
.Bl -tag -width /var/log/wtmp.[0-6] -compact
.It Pa /var/run/utmp
.It Pa /var/log/wtmp
.It Pa /var/log/wtmp.[0-6]
.El
.Sh SEE ALSO
.Xr last 1 ,
.Xr users 1 ,
.Xr getuid 2 ,
.Xr utmp 5
.Sh HISTORY
A
.BR who
command appeared in Version 6 AT&T UNIX.
.Nm
command appeared in
.At v6 .

View File

@ -50,7 +50,7 @@ static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
#include <pwd.h>
#include <utmp.h>
#include <stdio.h>
#ifdef __ORCAC__
#ifdef __GNO__
#include <sys/errno.h>
#include <string.h>
#include <stdlib.h>
@ -60,26 +60,18 @@ static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
static void output(struct utmp *up);
static FILE *file(char *name);
#ifdef __ORCAC__
char *__progname = NULL;
#endif
int
main(int argc, char **argv)
{
register char *p;
static struct utmp usr;
struct passwd *pw;
#ifdef __ORCAC__
FILE *ufp;
char *t;
register char *p;
static struct utmp usr;
struct passwd *pw;
#ifdef __GNO__
FILE *ufp;
char *t;
#else
FILE *ufp, *file();
char *t, *rindex(), *strcpy(), *strncpy(), *ttyname();
#endif
#ifdef __ORCAC__
__progname = argv[0];
FILE *ufp, *file();
char *t, *rindex(), *strcpy(), *strncpy(), *ttyname();
#endif
switch (argc) {
@ -133,7 +125,7 @@ static char buf[80];
(void)printf("%-*.*s %-*.*s", UT_NAMESIZE, UT_NAMESIZE, up->ut_name,
UT_LINESIZE, UT_LINESIZE, up->ut_line);
#ifdef __ORCAC__
#ifdef __GNO__
sprintf(buf, "%s", asctime(localtime(&up->ut_time)));
#else
(void)strftime(buf, sizeof(buf), "%c", localtime(&up->ut_time));
@ -147,10 +139,10 @@ static char buf[80];
static FILE *
file(char *name)
{
extern int errno;
FILE *ufp;
#ifndef __ORCAC__
char *strerror();
extern int errno;
FILE *ufp;
#ifndef __GNO__
char *strerror();
#endif
if (!(ufp = fopen(name, "r"))) {

9
usr.bin/who/who.desc Normal file
View File

@ -0,0 +1,9 @@
Name: who
Version: 1.0 (October 1997)
Shell: GNO
Author: Derek Taubert (from FreeBSD 2.1.0 code)
Contact: taubert@geeks.org
Where: /usr/bin
FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com
Display users on the system.

31
usr.bin/who/who.rez Normal file
View File

@ -0,0 +1,31 @@
/*
* Resources for who version and comment
*
* $Id: who.rez,v 1.1 1998/01/25 23:36:30 taubert Exp $
*/
#define PROG "who"
#define DESC "Display users on the system."
#include "Types.rez"
/*
* Version
*/
resource rVersion (1, purgeable3) {
{ 1, 0, 0, /* Version 1.0.0 */
release, /* development|alpha|beta|final|release */
0 }, /* non-final release number */
verUS, /* Country */
PROG, /* Program name */
DESC " Released with GNO/ME."
};
/*
* Comment
*/
resource rComment (1, purgeable3) {
PROG " v1.0 (October 1997)\n"
"GNO utility: " DESC "\n"
"Ported from FreeBSD 2.1.0 code by Derek Taubert."
};