Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144389600
D8815.id23007.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D8815.id23007.diff
View Options
Index: usr.sbin/cron/crontab/crontab.1
===================================================================
--- usr.sbin/cron/crontab/crontab.1
+++ usr.sbin/cron/crontab/crontab.1
@@ -17,7 +17,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 13, 2010
+.Dd December 16, 2016
.Dt CRONTAB 1
.Os
.Sh NAME
@@ -31,7 +31,8 @@
.Op Fl u Ar user
{
.Fl l |
-.Fl r |
+.Fl r Op Fl f
+|
.Fl e
}
.Sh DESCRIPTION
@@ -96,7 +97,11 @@
.It Fl l
Display the current crontab on standard output.
.It Fl r
-Remove the current crontab.
+Remove the current crontab. By default the
+.Fl r
+option prompts for confirmation, adding the
+.Fl f
+option will attempt to remove the current crontab without confirmation.
.It Fl e
Edit the current crontab using the editor specified by
the
Index: usr.sbin/cron/crontab/crontab.c
===================================================================
--- usr.sbin/cron/crontab/crontab.c
+++ usr.sbin/cron/crontab/crontab.c
@@ -63,6 +63,7 @@
static FILE *NewCrontab;
static int CheckErrorCount;
static enum opt_t Option;
+static int fflag;
static struct passwd *pw;
static void list_cmd(void),
delete_cmd(void),
@@ -79,7 +80,7 @@
fprintf(stderr, "crontab: usage error: %s\n", msg);
fprintf(stderr, "%s\n%s\n",
"usage: crontab [-u user] file",
- " crontab [-u user] { -e | -l | -r }");
+ " crontab [-u user] { -l | -r [-f] | -e }");
exit(ERROR_EXIT);
}
@@ -142,7 +143,7 @@
strcpy(RealUser, User);
Filename[0] = '\0';
Option = opt_unknown;
- while ((argch = getopt(argc, argv, "u:lerx:")) != -1) {
+ while ((argch = getopt(argc, argv, "u:lerx:f")) != -1) {
switch (argch) {
case 'x':
if (!set_debug_flags(optarg))
@@ -172,6 +173,9 @@
usage("only one operation permitted");
Option = opt_edit;
break;
+ case 'f':
+ fflag = 1;
+ break;
default:
usage("unrecognized option");
}
@@ -282,7 +286,7 @@
char n[MAX_FNAME];
int ch, first;
- if (isatty(STDIN_FILENO)) {
+ if (!fflag && isatty(STDIN_FILENO)) {
(void)fprintf(stderr, "remove crontab for %s? ", User);
first = ch = getchar();
while (ch != '\n' && ch != EOF)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 4:47 AM (6 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28539458
Default Alt Text
D8815.id23007.diff (2 KB)
Attached To
Mode
D8815: Add a 'force' option for non-interactive crontab removal
Attached
Detach File
Event Timeline
Log In to Comment