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:
Peter Wemm 2001-04-13 01:45:22 +00:00
parent 584096c53e
commit 8966f5046e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75456

View File

@ -226,7 +226,7 @@ static void
list_cmd() { list_cmd() {
char n[MAX_FNAME]; char n[MAX_FNAME];
FILE *f; FILE *f;
int ch; int ch, x;
log_it(RealUser, Pid, "LIST", User); log_it(RealUser, Pid, "LIST", User);
(void) sprintf(n, CRON_TAB(User)); (void) sprintf(n, CRON_TAB(User));
@ -240,6 +240,24 @@ list_cmd() {
/* file is open. copy to stdout, close. /* file is open. copy to stdout, close.
*/ */
Set_LineNum(1) 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))) while (EOF != (ch = get_char(f)))
putchar(ch); putchar(ch);
fclose(f); fclose(f);