diff options
author | obrien <obrien@FreeBSD.org> | 2001-07-31 16:25:55 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-07-31 16:25:55 +0000 |
commit | bee43330be72b370afc45a2cc59ef061a16cc349 (patch) | |
tree | 40173498ba7773c5e827a8c089c8086966c3aad4 /usr.sbin/newsyslog | |
parent | eb299211aeebd7b080100b6dabe27a754a6c36d7 (diff) | |
download | FreeBSD-src-bee43330be72b370afc45a2cc59ef061a16cc349.zip FreeBSD-src-bee43330be72b370afc45a2cc59ef061a16cc349.tar.gz |
jhb says a 10 line change containing casts is more invasive than a 28 line
change.
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r-- | usr.sbin/newsyslog/newsyslog.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index 150ce51..20033ce 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -1006,7 +1006,7 @@ parseDWM(char *s) { char *t; struct tm tm, *tmp; - u_long ul; + long l; int nd; static int mtab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int WMseen = 0; @@ -1035,10 +1035,10 @@ parseDWM(char *s) return -1; Dseen++; s++; - ul = strtoul(s, &t, 10); - if (ul > 23) + l = strtol(s, &t, 10); + if (l < 0 || l > 23) return -1; - tm.tm_hour = ul; + tm.tm_hour = l; break; case 'W': @@ -1046,17 +1046,17 @@ parseDWM(char *s) return -1; WMseen++; s++; - ul = strtoul(s, &t, 10); - if (ul > 6) + l = strtol(s, &t, 10); + if (l < 0 || l > 6) return -1; - if (ul != (unsigned)tm.tm_wday) { + if (l != tm.tm_wday) { int save; - if (ul < (unsigned)tm.tm_wday) { + if (l < tm.tm_wday) { save = 6 - tm.tm_wday; - save += (ul + 1); + save += (l + 1); } else { - save = ul - tm.tm_wday; + save = l - tm.tm_wday; } tm.tm_mday += save; @@ -1078,13 +1078,13 @@ parseDWM(char *s) s++; t = s; } else { - ul = strtoul(s, &t, 10); - if (ul < 1 || ul > 31) + l = strtol(s, &t, 10); + if (l < 1 || l > 31) return -1; - if (ul > (unsigned)nd) + if (l > nd) return -1; - tm.tm_mday = ul; + tm.tm_mday = l; } break; |