From owner-svn-src-head@FreeBSD.ORG Thu Dec 13 01:44:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8AD838DB; Thu, 13 Dec 2012 01:44:59 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6D5518FC08; Thu, 13 Dec 2012 01:44:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBD1ixZJ006878; Thu, 13 Dec 2012 01:44:59 GMT (envelope-from grog@svn.freebsd.org) Received: (from grog@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBD1ixxP006877; Thu, 13 Dec 2012 01:44:59 GMT (envelope-from grog@svn.freebsd.org) Message-Id: <201212130144.qBD1ixxP006877@svn.freebsd.org> From: Greg Lehey Date: Thu, 13 Dec 2012 01:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244166 - head/usr.bin/calendar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 01:44:59 -0000 Author: grog Date: Thu Dec 13 01:44:58 2012 New Revision: 244166 URL: http://svnweb.freebsd.org/changeset/base/244166 Log: Reluctantly remove one of the most extraordinary numeric conversion routines I have ever seen and replace with something far more boring. Modified: head/usr.bin/calendar/parsedata.c Modified: head/usr.bin/calendar/parsedata.c ============================================================================== --- head/usr.bin/calendar/parsedata.c Thu Dec 13 01:39:49 2012 (r244165) +++ head/usr.bin/calendar/parsedata.c Thu Dec 13 01:44:58 2012 (r244166) @@ -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++) {