Reluctantly remove one of the most extraordinary numeric conversion

routines I have ever seen and replace with something far more boring.
This commit is contained in:
Greg Lehey 2012-12-13 01:44:58 +00:00
parent 7b4708028a
commit d6a381f8c9

View File

@ -940,16 +940,14 @@ 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)
i = strtod (s, &es);
if (*es != '\0') /* trailing junk */
errx (1, "Invalid specifier format: %s\n", s);
return (i);
}
return (0);
}
for (i = 0; i < 6; i++) {
if (strcasecmp(s, sequences[i]) == 0) {