From d74956ff5180709d92a363d57515a95e71b1e650 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 13 Apr 2001 01:45:22 +0000 Subject: 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. --- usr.sbin/cron/crontab/crontab.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'usr.sbin/cron') 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); -- cgit v1.1