=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/lib.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- src/usr.bin/awk/lib.c 2020/06/16 16:14:22 1.37 +++ src/usr.bin/awk/lib.c 2020/06/26 15:50:06 1.38 @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.37 2020/06/16 16:14:22 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.38 2020/06/26 15:50:06 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -760,6 +760,9 @@ /* 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 int is_number(const char *s) @@ -770,7 +773,8 @@ 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;