diff options
author | peter <peter@FreeBSD.org> | 2001-04-13 01:45:22 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-04-13 01:45:22 +0000 |
commit | d74956ff5180709d92a363d57515a95e71b1e650 (patch) | |
tree | ce8e1a2b463e2d42dff979a13ac2844f781ed895 /usr.sbin/cron | |
parent | 9aaff3ecb131856f23659c7785b1c980282ebdf8 (diff) | |
download | FreeBSD-src-d74956ff5180709d92a363d57515a95e71b1e650.zip FreeBSD-src-d74956ff5180709d92a363d57515a95e71b1e650.tar.gz |
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.
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r-- | usr.sbin/cron/crontab/crontab.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/cron/crontab/crontab.c b/usr.sbin/cron/crontab/crontab.c index 8ee2ccb..deea864 100644 --- a/usr.sbin/cron/crontab/crontab.c +++ b/usr.sbin/cron/crontab/crontab.c @@ -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); |