aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2020-06-12 14:30:03 +0300
committerArnold D. Robbins <arnold@skeeve.com>2020-06-12 14:30:03 +0300
commitcef51801109a3032c66aa76503a92ce66724725a (patch)
tree7346c2bd887a47aa3226b161f7dc8f19669d2222
parentb2de1c4ee74c1283bae52cd6a94a56308430f79e (diff)
downloadone-true-awk-cef51801109a3032c66aa76503a92ce66724725a.tar.gz
Fix Issue 78 and apply PR 80.
-rw-r--r--FIXES9
-rw-r--r--lib.c6
-rw-r--r--main.c2
3 files changed, 15 insertions, 2 deletions
diff --git a/FIXES b/FIXES
index f002f0c..4cbcca2 100644
--- a/FIXES
+++ b/FIXES
@@ -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>
diff --git a/lib.c b/lib.c
index a98ffee..27ef30f 100644
--- a/lib.c
+++ b/lib.c
@@ -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;
diff --git a/main.c b/main.c
index 7b19557..269f0a8 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 20200605";
+const char *version = "version 20200612";
#define DEBUG
#include <stdio.h>