diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2020-06-12 14:30:03 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2020-06-12 14:30:03 +0300 |
commit | cef51801109a3032c66aa76503a92ce66724725a (patch) | |
tree | 7346c2bd887a47aa3226b161f7dc8f19669d2222 | |
parent | b2de1c4ee74c1283bae52cd6a94a56308430f79e (diff) | |
download | one-true-awk-cef51801109a3032c66aa76503a92ce66724725a.tar.gz |
Fix Issue 78 and apply PR 80.
-rw-r--r-- | FIXES | 9 | ||||
-rw-r--r-- | lib.c | 6 | ||||
-rw-r--r-- | main.c | 2 |
3 files changed, 15 insertions, 2 deletions
@@ -25,6 +25,15 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +June 12, 2020: + Clear errno before calling errcheck to avoid any spurious errors + left over from previous calls that may have set it. Thanks to + Todd Miller for the fix, from PR #80. + + Fix Issue #78 by allowing \r to follow floating point numbers in + lib.c:is_number. Thanks to GitHub user ajcarr for the report + and to Arnold Robbins for the fix. + June 5, 2020: In fldbld(), make sure that inputFS is set before trying to use it. Thanks to Steffen Nurpmeso <steffen@sdaoden.eu> @@ -758,6 +758,9 @@ int isclvar(const char *s) /* is s of form var=something ? */ /* strtod is supposed to be a proper test of what's a valid number */ /* appears to be broken in gcc on linux: thinks 0x123 is a valid FP number */ /* wrong: violates 4.10.1.4 of ansi C standard */ +/* well, not quite. As of C99, hex floating point is allowed. so this is + * a bit of a mess. + */ #include <math.h> int is_number(const char *s) @@ -768,7 +771,8 @@ int is_number(const char *s) r = strtod(s, &ep); if (ep == s || r == HUGE_VAL || errno == ERANGE) return 0; - while (*ep == ' ' || *ep == '\t' || *ep == '\n') + /* allow \r as well. windows files aren't going to go away. */ + while (*ep == ' ' || *ep == '\t' || *ep == '\n' || *ep == '\r') ep++; if (*ep == '\0') return 1; @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20200605"; +const char *version = "version 20200612"; #define DEBUG #include <stdio.h> |