diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-05-01 01:29:18 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-05-01 01:29:18 +0200 |
commit | a958272d76178102b2f0666f53fac3359d1146bf (patch) | |
tree | 3372db02d7dca62feabb6dcf2a687b60878af1b6 /src/usr.bin/calendar/io.c | |
parent | de8276e8aa55ee4c0fdafe0aa739af45fa0f8387 (diff) | |
download | outils-a958272d76178102b2f0666f53fac3359d1146bf.tar.gz outils-a958272d76178102b2f0666f53fac3359d1146bf.tar.xz outils-a958272d76178102b2f0666f53fac3359d1146bf.zip |
cvs update
Diffstat (limited to 'src/usr.bin/calendar/io.c')
-rw-r--r-- | src/usr.bin/calendar/io.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/usr.bin/calendar/io.c b/src/usr.bin/calendar/io.c index 31c413b..1e1950b 100644 --- a/src/usr.bin/calendar/io.c +++ b/src/usr.bin/calendar/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.37 2015/01/16 06:40:06 deraadt Exp $ */ +/* $OpenBSD: io.c,v 1.39 2015/04/18 18:28:37 deraadt Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -44,7 +44,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <tzfile.h> #include <unistd.h> #include <limits.h> @@ -282,12 +281,16 @@ getfield(char *p, char **endp, int *flags) } } if (i > NUMEV) { - switch(*start) { + const char *errstr; + + switch (*start) { case '-': case '+': - var = atoi(start); - if (var > 365 || var < -365) + var = strtonum(start + 1, 0, 365, &errstr); + if (errstr) return (0); /* Someone is just being silly */ + if (*start == '-') + var = -var; val += (NUMEV + 1) * var; /* We add one to the matching event and multiply by * (NUMEV + 1) so as not to return 0 if there's a match. |