diff options
author | ozan s. yigit <oz@silentrunning.ca> | 2021-01-06 18:37:48 -0500 |
---|---|---|
committer | ozan s. yigit <oz@silentrunning.ca> | 2021-01-06 18:37:48 -0500 |
commit | 1fd5fa38cc801a9fb77494c2c3fce8f2403c5402 (patch) | |
tree | 7ec9813f76f47cd4a1ffcb29e72eca1faa35b731 | |
parent | 7d1848cfa6b7b3bb9a7c851339626982198a57bc (diff) | |
download | one-true-awk-1fd5fa38cc801a9fb77494c2c3fce8f2403c5402.tar.gz |
Fix a decision bug with trailing stuff in lib.c:is_valid_number
after dec 18 changes. updated FIXES, adjusted version date.
-rw-r--r-- | FIXES | 4 | ||||
-rw-r--r-- | lib.c | 9 | ||||
-rw-r--r-- | main.c | 2 |
3 files changed, 13 insertions, 2 deletions
@@ -25,6 +25,10 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +January 06, 2021: + Fix a decision bug with trailing stuff in lib.c:is_valid_number + after recent changes. Thanks to Ozan Yigit. + December 18, 2020: Fix problems converting inf and NaN values in lib.c:is_valid_number. Enhance number to string conversion to do the right thing for @@ -822,10 +822,17 @@ convert: if (result != NULL) *result = r; - retval = (isspace(*ep) || *ep == '\0' || trailing_stuff_ok); + /* + * check for trailing stuff + */ + while (isspace(*ep)) + ep++; if (no_trailing != NULL) *no_trailing = (*ep == '\0'); + // return true if found the end, or trailing stuff is allowed + retval = *ep == '\0' || trailing_stuff_ok; + return retval; } @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20201218"; +const char *version = "version 20210106"; #define DEBUG #include <stdio.h> |