diff options
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r-- | usr.sbin/cron/lib/entry.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/cron/lib/entry.c b/usr.sbin/cron/lib/entry.c index 51c1a0c..9150a0d 100644 --- a/usr.sbin/cron/lib/entry.c +++ b/usr.sbin/cron/lib/entry.c @@ -135,36 +135,43 @@ load_entry(file, error_func, pw, envp) * anymore. too much for my overloaded brain. (vix, jan90) * HINT */ + Debug(DPARS, ("load_entry()...about to test shortcuts\n")) ch = get_string(cmd, MAX_COMMAND, file, " \t\n"); if (!strcmp("reboot", cmd)) { + Debug(DPARS, ("load_entry()...reboot shortcut\n")) e->flags |= WHEN_REBOOT; } else if (!strcmp("yearly", cmd) || !strcmp("annually", cmd)){ + Debug(DPARS, ("load_entry()...yearly shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_set(e->dom, 0); bit_set(e->month, 0); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); } else if (!strcmp("monthly", cmd)) { + Debug(DPARS, ("load_entry()...monthly shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_set(e->dom, 0); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); } else if (!strcmp("weekly", cmd)) { + Debug(DPARS, ("load_entry()...weekly shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_set(e->dow, 0); } else if (!strcmp("daily", cmd) || !strcmp("midnight", cmd)) { + Debug(DPARS, ("load_entry()...daily shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); } else if (!strcmp("hourly", cmd)) { + Debug(DPARS, ("load_entry()...hourly shortcut\n")) bit_set(e->minute, 0); - bit_set(e->hour, (LAST_HOUR-FIRST_HOUR+1)); + bit_nset(e->hour, 0, (LAST_HOUR-FIRST_HOUR+1)); bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); @@ -172,6 +179,14 @@ load_entry(file, error_func, pw, envp) ecode = e_timespec; goto eof; } + /* Advance past whitespace between shortcut and + * username/command. + */ + Skip_Blanks(ch, file); + if (ch == EOF) { + ecode = e_cmd; + goto eof; + } } else { Debug(DPARS, ("load_entry()...about to parse numerics\n")) |