From efc2b3a66b2b5a93b3f33cd2a6183eeebea8caf1 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 26 Apr 1998 17:01:03 +0000 Subject: catch "rwho foo" as illegal; ru@ucb.crimea.ua --- usr.bin/rwho/rwho.c | 19 +++++++++++++++---- 1 file 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 @@ -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); -- cgit v1.2.3