=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/newsyslog/newsyslog.c,v retrieving revision 1.79 retrieving revision 1.80 diff -c -r1.79 -r1.80 *** src/usr.bin/newsyslog/newsyslog.c 2004/04/09 19:21:15 1.79 --- src/usr.bin/newsyslog/newsyslog.c 2004/05/10 05:32:16 1.80 *************** *** 1,4 **** ! /* $OpenBSD: newsyslog.c,v 1.79 2004/04/09 19:21:15 millert Exp $ */ /* * Copyright (c) 1999, 2002, 2003 Todd C. Miller --- 1,4 ---- ! /* $OpenBSD: newsyslog.c,v 1.80 2004/05/10 05:32:16 deraadt Exp $ */ /* * Copyright (c) 1999, 2002, 2003 Todd C. Miller *************** *** 72,78 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.79 2004/04/09 19:21:15 millert Exp $"; #endif /* not lint */ #ifndef CONF --- 72,78 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.80 2004/05/10 05:32:16 deraadt Exp $"; #endif /* not lint */ #ifndef CONF *************** *** 192,199 **** { struct conf_entry *p, *q, *x, *y; struct pidinfo *pidlist, *pl; - char **av; int status, listlen; parse_args(argc, argv); argc -= optind; --- 192,199 ---- { struct conf_entry *p, *q, *x, *y; struct pidinfo *pidlist, *pl; int status, listlen; + char **av; parse_args(argc, argv); argc -= optind; *************** *** 295,303 **** void do_entry(struct conf_entry *ent) { int modtime; off_t size; - struct stat sb; if (lstat(ent->log, &sb) != 0) return; --- 295,303 ---- void do_entry(struct conf_entry *ent) { + struct stat sb; int modtime; off_t size; if (lstat(ent->log, &sb) != 0) return; *************** *** 371,380 **** void send_signal(char *pidfile, int signal) { - pid_t pid; - FILE *f; char line[BUFSIZ], *ep, *err; long lval; if ((f = fopen(pidfile, "r")) == NULL) { warn("can't open %s", pidfile); --- 371,380 ---- void send_signal(char *pidfile, int signal) { char line[BUFSIZ], *ep, *err; + pid_t pid; long lval; + FILE *f; if ((f = fopen(pidfile, "r")) == NULL) { warn("can't open %s", pidfile); *************** *** 416,423 **** void parse_args(int argc, char **argv) { - int ch; char *p; timenow = time(NULL); daytime = ctime(&timenow) + 4; --- 416,423 ---- void parse_args(int argc, char **argv) { char *p; + int ch; timenow = time(NULL); daytime = ctime(&timenow) + 4; *************** *** 478,492 **** struct conf_entry * parse_file(int *nentries) { - FILE *f; char line[BUFSIZ], *parse, *q, *errline, *group, *tmp, *ep; ! int lineno; ! long l; ! struct conf_entry *first = NULL; ! struct conf_entry *working = NULL; struct passwd *pwd; struct group *grp; struct stat sb; if (strcmp(conf, "-") == 0) f = stdin; --- 478,491 ---- struct conf_entry * parse_file(int *nentries) { char line[BUFSIZ], *parse, *q, *errline, *group, *tmp, *ep; ! struct conf_entry *working = NULL, *first = NULL; struct passwd *pwd; struct group *grp; struct stat sb; + int lineno; + FILE *f; + long l; if (strcmp(conf, "-") == 0) f = stdin; *************** *** 503,514 **** err(1, "strdup"); (*nentries)++; if (!first) { ! working = (struct conf_entry *) malloc(sizeof(struct conf_entry)); if (working == NULL) err(1, "malloc"); first = working; } else { ! working->next = (struct conf_entry *) malloc(sizeof(struct conf_entry)); if (working->next == NULL) err(1, "malloc"); working = working->next; --- 502,513 ---- err(1, "strdup"); (*nentries)++; if (!first) { ! working = malloc(sizeof(struct conf_entry)); if (working == NULL) err(1, "malloc"); first = working; } else { ! working->next = malloc(sizeof(struct conf_entry)); if (working->next == NULL) err(1, "malloc"); working = working->next; *************** *** 543,549 **** if (*q) { if (!(isnumberstr(q))) { if ((grp = getgrnam(q)) == NULL) - errx(1, "%s:%d: unknown group: %s", conf, lineno, q); working->gid = grp->gr_gid; --- 542,547 ---- *************** *** 755,762 **** { char file1[MAXPATHLEN], file2[MAXPATHLEN]; char oldlog[MAXPATHLEN], *suffix; ! int fd; ! int numdays = ent->numlogs; /* Is there a separate backup dir? */ if (ent->backdir != NULL) --- 753,759 ---- { char file1[MAXPATHLEN], file2[MAXPATHLEN]; char oldlog[MAXPATHLEN], *suffix; ! int numdays = ent->numlogs, fd; /* Is there a separate backup dir? */ if (ent->backdir != NULL) *************** *** 864,871 **** void compress_log(struct conf_entry *ent) { - pid_t pid; char *base, tmp[MAXPATHLEN]; if (ent->backdir != NULL) snprintf(tmp, sizeof(tmp), "%s/%s.0", ent->backdir, --- 861,868 ---- void compress_log(struct conf_entry *ent) { char *base, tmp[MAXPATHLEN]; + pid_t pid; if (ent->backdir != NULL) snprintf(tmp, sizeof(tmp), "%s/%s.0", ent->backdir, *************** *** 906,913 **** int age_old_log(struct conf_entry *ent) { - struct stat sb; char file[MAXPATHLEN]; if (ent->backdir != NULL) (void)snprintf(file, sizeof(file), "%s/%s.0", ent->backdir, --- 903,910 ---- int age_old_log(struct conf_entry *ent) { char file[MAXPATHLEN]; + struct stat sb; if (ent->backdir != NULL) (void)snprintf(file, sizeof(file), "%s/%s.0", ent->backdir, *************** *** 958,967 **** int domonitor(struct conf_entry *ent) { - struct stat sb, tsb; char fname[MAXPATHLEN], *flog, *p, *rb = NULL; ! FILE *fp; off_t osize; int rd; if (stat(ent->log, &sb) < 0) --- 955,964 ---- int domonitor(struct conf_entry *ent) { char fname[MAXPATHLEN], *flog, *p, *rb = NULL; ! struct stat sb, tsb; off_t osize; + FILE *fp; int rd; if (stat(ent->log, &sb) < 0) *************** *** 1067,1074 **** FILE * openmail(void) { - FILE *ret; char *cmdbuf = NULL; if (asprintf(&cmdbuf, "%s -t", SENDMAIL) != -1) { ret = popen(cmdbuf, "w"); --- 1064,1071 ---- FILE * openmail(void) { char *cmdbuf = NULL; + FILE *ret; if (asprintf(&cmdbuf, "%s -t", SENDMAIL) != -1) { ret = popen(cmdbuf, "w"); *************** *** 1137,1144 **** time_t parse8601(char *s) { - char *t; struct tm tm, *tmp; long l; tmp = localtime(&timenow); --- 1134,1141 ---- time_t parse8601(char *s) { struct tm tm, *tmp; + char *t; long l; tmp = localtime(&timenow); *************** *** 1175,1182 **** } /* sanity check */ ! if (tm.tm_year < 70 || tm.tm_mon < 0 || tm.tm_mon > 12 ! || tm.tm_mday < 1 || tm.tm_mday > 31) return (-1); if (*t != '\0') { --- 1172,1179 ---- } /* sanity check */ ! if (tm.tm_year < 70 || tm.tm_mon < 0 || tm.tm_mon > 12 || ! tm.tm_mday < 1 || tm.tm_mday > 31) return (-1); if (*t != '\0') { *************** *** 1201,1208 **** } /* sanity check */ ! if (tm.tm_sec < 0 || tm.tm_sec > 60 || tm.tm_min < 0 ! || tm.tm_min > 59 || tm.tm_hour < 0 || tm.tm_hour > 23) return (-1); } return (mktime(&tm)); --- 1198,1205 ---- } /* sanity check */ ! if (tm.tm_sec < 0 || tm.tm_sec > 60 || tm.tm_min < 0 || ! tm.tm_min > 59 || tm.tm_hour < 0 || tm.tm_hour > 23) return (-1); } return (mktime(&tm)); *************** *** 1225,1237 **** time_t parseDWM(char *s) { ! char *t; struct tm tm, *tmp; long l; - int nd; - static int mtab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - int WMseen = 0; - int Dseen = 0; tmp = localtime(&timenow); tm = *tmp; --- 1222,1232 ---- time_t parseDWM(char *s) { ! static int mtab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; ! int WMseen = 0, Dseen = 0, nd; struct tm tm, *tmp; + char *t; long l; tmp = localtime(&timenow); tm = *tmp;