summaryrefslogtreecommitdiff
path: root/usr.sbin/cron/entry.c
diff options
context:
space:
mode:
authorjob <job@cvs.openbsd.org>2018-06-13 11:27:31 +0000
committerjob <job@cvs.openbsd.org>2018-06-13 11:27:31 +0000
commitffebb6c34c09a29f5b265d36ca12f1d79278c089 (patch)
treeefc7fb01609ac59ecd75e1b03e22bc64eec44824 /usr.sbin/cron/entry.c
parent442a17b8b75aa93a5dbb58b2d44f69df11dbfc3c (diff)
Add crontab entry option -n for "No mail when run successful"
OK jmc@ millert@
Diffstat (limited to 'usr.sbin/cron/entry.c')
-rw-r--r--usr.sbin/cron/entry.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.sbin/cron/entry.c b/usr.sbin/cron/entry.c
index 761f01d3d6f..bb0221bffb6 100644
--- a/usr.sbin/cron/entry.c
+++ b/usr.sbin/cron/entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entry.c,v 1.48 2015/11/14 13:09:14 millert Exp $ */
+/* $OpenBSD: entry.c,v 1.49 2018/06/13 11:27:30 job Exp $ */
/*
* Copyright 1988,1990,1993,1994 by Paul Vixie
@@ -338,14 +338,32 @@ load_entry(FILE *file, void (*error_func)(const char *), struct passwd *pw,
ch = get_char(file);
while (ch == '-') {
switch (ch = get_char(file)) {
+ case 'n':
+ /* only allow the user to set the option once */
+ if ((e->flags & MAIL_WHEN_ERR) == MAIL_WHEN_ERR) {
+ ecode = e_option;
+ goto eof;
+ }
+ e->flags |= MAIL_WHEN_ERR;
+ break;
case 'q':
+ /* only allow the user to set the option once */
+ if ((e->flags & DONT_LOG) == DONT_LOG) {
+ ecode = e_option;
+ goto eof;
+ }
e->flags |= DONT_LOG;
- Skip_Nonblanks(ch, file)
break;
default:
ecode = e_option;
goto eof;
}
+ ch = get_char(file);
+ if (ch!='\t' && ch!=' ') {
+ ecode = e_option;
+ goto eof;
+ }
+
Skip_Blanks(ch, file)
if (ch == EOF || ch == '\n') {
ecode = e_cmd;