diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 13:14:38 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 13:14:38 +0300 |
commit | fae4762eba9ff7bb466a600130e9c90eaac6b0bc (patch) | |
tree | 62711fe7cd511824b5f8a90ba1ba7b523d42e127 /missing_d/strtod.c | |
parent | bc70de7b3302d5a81515b901cae376b8b51d2004 (diff) | |
download | egawk-fae4762eba9ff7bb466a600130e9c90eaac6b0bc.tar.gz egawk-fae4762eba9ff7bb466a600130e9c90eaac6b0bc.tar.bz2 egawk-fae4762eba9ff7bb466a600130e9c90eaac6b0bc.zip |
Move to gawk-3.1.1.
Diffstat (limited to 'missing_d/strtod.c')
-rw-r--r-- | missing_d/strtod.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/missing_d/strtod.c b/missing_d/strtod.c index cdcefe9f..2c4ee574 100644 --- a/missing_d/strtod.c +++ b/missing_d/strtod.c @@ -22,6 +22,9 @@ * * Fall 2000: Changed to enforce C89 semantics, so that 0x... returns 0. * C99 has hexadecimal floating point numbers. + * + * Summer 2001. Try to make it smarter, so that a string like "0000" + * doesn't look like we failed. Sigh. */ #if 0 @@ -36,8 +39,8 @@ register const char *s; register const char **ptr; { double ret = 0.0; - const char *start = s; - const char *begin = NULL; + const char *start = s; /* save original start of string */ + const char *begin = NULL; /* where the number really begins */ int success = 0; /* optional white space */ @@ -98,7 +101,7 @@ register const char **ptr; ret = atof(begin); out: - if (! success) + if (! success && s == begin) s = start; /* in case all we did was skip whitespace */ if (ptr) |