diff options
author | kris <kris@FreeBSD.org> | 2001-04-24 10:39:17 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-04-24 10:39:17 +0000 |
commit | fb2fd90f054f212d7bd754e9c6e071038ec2e5e7 (patch) | |
tree | c86feb04c6bef424722cec1133c192def533f69f | |
parent | e801e61e06cf7e9dd580502dabdee4ffa0a30007 (diff) | |
download | FreeBSD-src-fb2fd90f054f212d7bd754e9c6e071038ec2e5e7.zip FreeBSD-src-fb2fd90f054f212d7bd754e9c6e071038ec2e5e7.tar.gz |
Call usage() if given more than 1 argument.
Submitted by: "Andrew R. Reiter" <arr@watson.org>
Obtained from: OpenBSD
-rw-r--r-- | usr.bin/leave/leave.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c index d764655..cfcbc75 100644 --- a/usr.bin/leave/leave.c +++ b/usr.bin/leave/leave.c @@ -69,7 +69,7 @@ main(argc, argv) { register u_int secs; register int hours, minutes; - register char c, *cp; + register char c, *cp = NULL; struct tm *t, *localtime(); time_t now, time(); int plusnow, t_12_hour; @@ -84,7 +84,9 @@ main(argc, argv) cp = fgets(buf, sizeof(buf), stdin); if (cp == NULL || *cp == '\n') exit(0); - } else + } else if (argc > 2) + usage(); + else cp = argv[1]; if (*cp == '+') { |