aboutsummaryrefslogtreecommitdiff
path: root/lib.c
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 /lib.c
parentb2de1c4ee74c1283bae52cd6a94a56308430f79e (diff)
downloadone-true-awk-cef51801109a3032c66aa76503a92ce66724725a.tar.gz
Fix Issue 78 and apply PR 80.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c6
1 files changed, 5 insertions, 1 deletions
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;