diff options
author | grog <grog@FreeBSD.org> | 2012-12-13 01:44:58 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 2012-12-13 01:44:58 +0000 |
commit | f042d5b8f0b13d59e8eb9091d1b2373e33570ca4 (patch) | |
tree | b433cbc0715787af5f049d8606d67ec60a1c5142 /usr.bin/calendar | |
parent | ed59b019d44cf187e772a20972d22af7e0f2b360 (diff) | |
download | FreeBSD-src-f042d5b8f0b13d59e8eb9091d1b2373e33570ca4.zip FreeBSD-src-f042d5b8f0b13d59e8eb9091d1b2373e33570ca4.tar.gz |
Reluctantly remove one of the most extraordinary numeric conversion
routines I have ever seen and replace with something far more boring.
Diffstat (limited to 'usr.bin/calendar')
-rw-r--r-- | usr.bin/calendar/parsedata.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/calendar/parsedata.c b/usr.bin/calendar/parsedata.c index 63e4395..4d45385 100644 --- a/usr.bin/calendar/parsedata.c +++ b/usr.bin/calendar/parsedata.c @@ -940,15 +940,13 @@ indextooffset(char *s) { int i; struct fixs *n; + char *es; if (s[0] == '+' || s[0] == '-') { - char ss[9]; - for (i = -100; i < 100; i++) { - sprintf(ss, "%s%d", (i > 0) ? "+" : "", i); - if (strcmp(ss, s) == 0) - return (i); - } - return (0); + i = strtod (s, &es); + if (*es != '\0') /* trailing junk */ + errx (1, "Invalid specifier format: %s\n", s); + return (i); } for (i = 0; i < 6; i++) { |