Remove the 'DO NOT EDIT THIS FILE' crud that we spit out with 'crontab -l'.
Otherwise, "crontab -l > file; vi file; crontab file" adds an extra set of "DO NOT EDIT" markers each and every time which is a bit silly.
This commit is contained in:
parent
584096c53e
commit
8966f5046e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75456
@ -226,7 +226,7 @@ static void
|
||||
list_cmd() {
|
||||
char n[MAX_FNAME];
|
||||
FILE *f;
|
||||
int ch;
|
||||
int ch, x;
|
||||
|
||||
log_it(RealUser, Pid, "LIST", User);
|
||||
(void) sprintf(n, CRON_TAB(User));
|
||||
@ -240,6 +240,24 @@ list_cmd() {
|
||||
/* file is open. copy to stdout, close.
|
||||
*/
|
||||
Set_LineNum(1)
|
||||
|
||||
/* ignore the top few comments since we probably put them there.
|
||||
*/
|
||||
for (x = 0; x < NHEADER_LINES; x++) {
|
||||
ch = get_char(f);
|
||||
if (EOF == ch)
|
||||
break;
|
||||
if ('#' != ch) {
|
||||
putc(ch, NewCrontab);
|
||||
break;
|
||||
}
|
||||
while (EOF != (ch = get_char(f)))
|
||||
if (ch == '\n')
|
||||
break;
|
||||
if (EOF == ch)
|
||||
break;
|
||||
}
|
||||
|
||||
while (EOF != (ch = get_char(f)))
|
||||
putchar(ch);
|
||||
fclose(f);
|
||||
|
Loading…
Reference in New Issue
Block a user