Check that user really typed "who am {I,i}", and that no stray

arguments are given.
Note that usage() and the manpage disagree...

PR:		bin/6294
Suggested by:	Ruslan Ermilov and Bruce Evans
Submitted by:	Ruslan Ermilov (partly)
This commit is contained in:
Dag-Erling Smørgrav 1998-04-26 19:10:51 +00:00
parent 862a7e9c36
commit 574a97f5ce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=35470

View File

@ -45,7 +45,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
"$Id: who.c,v 1.5 1997/08/26 11:14:57 charnier Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -90,6 +90,10 @@ main(argc, argv)
output(&usr);
break;
case 3: /* who am i */
if (strcmp(argv[1], "am")
|| (strcmp(argv[2], "I") && strcmp(argv[2], "i")))
usage();
ufp = file(_PATH_UTMP);
/* search through the utmp and find an entry for this tty */