summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>2012-12-13 01:44:58 +0000
committergrog <grog@FreeBSD.org>2012-12-13 01:44:58 +0000
commitf042d5b8f0b13d59e8eb9091d1b2373e33570ca4 (patch)
treeb433cbc0715787af5f049d8606d67ec60a1c5142 /usr.bin
parented59b019d44cf187e772a20972d22af7e0f2b360 (diff)
downloadFreeBSD-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')
-rw-r--r--usr.bin/calendar/parsedata.c12
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++) {
OpenPOWER on IntegriCloud