summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-03-03 03:31:10 +0000
committermillert <millert@openbsd.org>1997-03-03 03:31:10 +0000
commit4afeb40de1509c73881bbe8c63c72a717f8646ef (patch)
tree97bc1e23fb3cf2c8fcc73d735bf31155af68f119
parentdon't try to fseek to before the beginning of the file; (diff)
downloadwireguard-openbsd-4afeb40de1509c73881bbe8c63c72a717f8646ef.tar.xz
wireguard-openbsd-4afeb40de1509c73881bbe8c63c72a717f8646ef.zip
Give usage message when atq used incorrectly.
-rw-r--r--usr.bin/at/at.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index d6003864d66..79e50a41068 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.9 1997/03/03 00:30:02 millert Exp $ */
+/* $OpenBSD: at.c,v 1.10 1997/03/03 03:31:10 millert Exp $ */
/* $NetBSD: at.c,v 1.4 1995/03/25 18:13:31 glass Exp $ */
/*
@@ -73,7 +73,7 @@ enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */
/* File scope variables */
#ifndef lint
-static char rcsid[] = "$OpenBSD: at.c,v 1.9 1997/03/03 00:30:02 millert Exp $";
+static char rcsid[] = "$OpenBSD: at.c,v 1.10 1997/03/03 03:31:10 millert Exp $";
#endif
char *no_export[] =
@@ -483,9 +483,6 @@ process_jobs(argc, argv, what)
char queue;
int jobno;
- if (optind == argc && (what == ATRM || what == CAT))
- usage();
-
PRIV_START
if (chdir(_PATH_ATJOBS) != 0)
@@ -675,14 +672,20 @@ main(argc, argv)
/* select our program */
switch (program) {
case ATQ:
+ if (optind != argc)
+ usage();
list_jobs();
break;
case ATRM:
+ if (optind == argc)
+ usage();
process_jobs(argc, argv, ATRM);
break;
case CAT:
+ if (optind == argc)
+ usage();
process_jobs(argc, argv, CAT);
break;