diff --git a/usr.bin/calendar/parsedata.c b/usr.bin/calendar/parsedata.c index 63e43957d61b..4d45385d3d1d 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++) {