From 30cfb241294100ece14c530fa5b432011772a014 Mon Sep 17 00:00:00 2001 From: Paul Richards Date: Sun, 15 Oct 2000 00:35:34 +0000 Subject: [PATCH] Since -e and -r are right next to each other prompt before clobbering a crontab you were planning to edit. --- usr.sbin/cron/crontab/crontab.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c index 1ae67770422..5490f4cac99 100644 --- a/usr.sbin/cron/crontab/crontab.c +++ b/usr.sbin/cron/crontab/crontab.c @@ -248,6 +248,16 @@ list_cmd() { static void delete_cmd() { char n[MAX_FNAME]; + int ch, first; + + if (isatty(STDIN_FILENO)) { + (void)fprintf(stderr, "remove crontab for %s? ", User); + first = ch = getchar(); + while (ch != '\n' && ch != EOF) + ch = getchar(); + if (first != 'y' && first != 'Y') + return; + } log_it(RealUser, Pid, "DELETE", User); (void) sprintf(n, CRON_TAB(User));