diff -rc cronolog-1.6.1/src/cronolog.c cronolog-1.6.1-ds/src/cronolog.c *** cronolog-1.6.1/src/cronolog.c Mon Dec 20 03:56:20 1999 --- cronolog-1.6.1-ds/src/cronolog.c Tue Oct 3 17:49:34 2000 *************** *** 88,94 **** /* Forward function declaration */ ! int new_log_file(const char *, const char *, mode_t, PERIODICITY, char *, size_t, time_t, time_t *); --- 88,94 ---- /* Forward function declaration */ ! int new_log_file(const char *, const char *, mode_t, const char*, PERIODICITY, char *, size_t, time_t, time_t *); *************** *** 101,106 **** --- 101,107 ---- "\n" \ " -H NAME, --hardlink=NAME maintain a hard link from NAME to current log\n" \ " -S NAME, --symlink=NAME maintain a symbolic link from NAME to current log\n" \ + " -p NAME, --prevlink=NAME maintain a link to the previous log file. \n" \ " -l NAME, --link=NAME same as -S/--symlink\n" \ " -h, --help print this help, then exit\n" \ " -o, --once-only create single output log from template (not rotated)\n" \ *************** *** 115,121 **** /* Definition of the short and long program options */ ! char *short_options = "aes:z:oH:S:l:hVx:"; struct option long_options[] = { { "american", no_argument, NULL, 'a' }, --- 116,122 ---- /* Definition of the short and long program options */ ! char *short_options = "aes:z:oH:S:p:l:hVx:"; struct option long_options[] = { { "american", no_argument, NULL, 'a' }, *************** *** 124,129 **** --- 125,131 ---- { "time-zone", required_argument, NULL, 'z' }, { "hardlink", required_argument, NULL, 'H' }, { "symlink", required_argument, NULL, 'S' }, + { "prevlink", required_argument, NULL, 'p' }, { "link", required_argument, NULL, 'l' }, { "once-only", no_argument, NULL, 'o' }, { "help", no_argument, NULL, 'h' }, *************** *** 143,148 **** --- 145,151 ---- char *start_time = NULL; char *template; char *linkname = NULL; + char *oldlink = NULL; mode_t linktype = 0; int n_bytes_read; int ch; *************** *** 182,187 **** --- 185,194 ---- linkname = optarg; linktype = S_IFLNK; break; + + case 'p': + oldlink = optarg; + break; case 'o': periodicity = ONCE_ONLY; *************** *** 279,285 **** */ if (log_fd < 0) { ! log_fd = new_log_file(template, linkname, linktype, periodicity, filename, sizeof (filename), time_now, &next_period); } --- 286,292 ---- */ if (log_fd < 0) { ! log_fd = new_log_file(template, linkname, linktype, oldlink, periodicity, filename, sizeof (filename), time_now, &next_period); } *************** *** 310,316 **** * supplied. */ int ! new_log_file(const char *template, const char *linkname, mode_t linktype, PERIODICITY periodicity, char *pfilename, size_t pfilename_len, time_t time_now, time_t *pnext_period) { --- 317,323 ---- * supplied. */ int ! new_log_file(const char *template, const char *linkname, mode_t linktype, const char * oldlink, PERIODICITY periodicity, char *pfilename, size_t pfilename_len, time_t time_now, time_t *pnext_period) { *************** *** 343,348 **** --- 350,360 ---- { perror(pfilename); exit(2); + } + + if(oldlink && linkname) + { + rename(linkname, oldlink); } if (linkname)