aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorozan s. yigit <oz@silentrunning.ca>2021-01-06 18:37:48 -0500
committerozan s. yigit <oz@silentrunning.ca>2021-01-06 18:37:48 -0500
commit1fd5fa38cc801a9fb77494c2c3fce8f2403c5402 (patch)
tree7ec9813f76f47cd4a1ffcb29e72eca1faa35b731
parent7d1848cfa6b7b3bb9a7c851339626982198a57bc (diff)
downloadone-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--FIXES4
-rw-r--r--lib.c9
-rw-r--r--main.c2
3 files changed, 13 insertions, 2 deletions
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 <stdio.h>