summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-04-26 17:01:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-04-26 17:01:03 +0000
commitefc2b3a66b2b5a93b3f33cd2a6183eeebea8caf1 (patch)
tree0df38e23fe41fa0192d0597a8ef1cc32e3143233 /usr.bin
parent106be53c2a4b1d44cba6d09d8e1c537ccd9bced3 (diff)
catch "rwho foo" as illegal; ru@ucb.crimea.ua
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rwho/rwho.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.bin/rwho/rwho.c b/usr.bin/rwho/rwho.c
index 51bca54e8e0..9e9356fa273 100644
--- a/usr.bin/rwho/rwho.c
+++ b/usr.bin/rwho/rwho.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rwho.c,v 1.9 1997/06/20 10:00:01 deraadt Exp $ */
+/* $OpenBSD: rwho.c,v 1.10 1998/04/26 17:01:02 deraadt Exp $ */
/*
* Copyright (c) 1983 The Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)rwho.c 5.5 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$OpenBSD: rwho.c,v 1.9 1997/06/20 10:00:01 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rwho.c,v 1.10 1998/04/26 17:01:02 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -78,6 +78,13 @@ char *ctime();
time_t now;
int aflg;
+void
+usage()
+{
+ fprintf(stderr, "usage: rwho [-a]\n");
+ exit(1);
+}
+
int
main(argc, argv)
int argc;
@@ -102,9 +109,13 @@ main(argc, argv)
break;
case '?':
default:
- fprintf(stderr, "usage: rwho [-a]\n");
- exit(1);
+ usage();
}
+ argc -= optind;
+ argv += optind;
+ if (argc != 0)
+ usage();
+
if (chdir(_PATH_RWHODIR) || (dirp = opendir(".")) == NULL) {
perror(_PATH_RWHODIR);
exit(1);