summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron/crontab
diff options
context:
space:
mode:
authorpaul <paul@FreeBSD.org>2000-10-15 00:35:34 +0000
committerpaul <paul@FreeBSD.org>2000-10-15 00:35:34 +0000
commit71e06852db4ba7be35c1ef5e0020ff889d00f0a9 (patch)
tree6569b592ac271b1bd08784ea7902f7a08d12c0a0 /usr.sbin/cron/crontab
parent0da67d8763b40cee624dca4977345ff34a4ea5aa (diff)
downloadFreeBSD-src-71e06852db4ba7be35c1ef5e0020ff889d00f0a9.zip
FreeBSD-src-71e06852db4ba7be35c1ef5e0020ff889d00f0a9.tar.gz
Since -e and -r are right next to each other prompt before clobbering
a crontab you were planning to edit.
Diffstat (limited to 'usr.sbin/cron/crontab')
-rw-r--r--usr.sbin/cron/crontab/crontab.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c
index 1ae6777..5490f4c 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));
OpenPOWER on IntegriCloud