diff --git a/FIXES b/FIXES index 20b4bd8..82c8f8f 100644 --- a/FIXES +++ b/FIXES @@ -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 diff --git a/lib.c b/lib.c index e8310a9..18adbd2 100644 --- a/lib.c +++ b/lib.c @@ -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; } diff --git a/main.c b/main.c index 5970cb4..2b1d64c 100644 --- a/main.c +++ b/main.c @@ -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