summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2020-06-26 15:50:07 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2020-06-26 15:50:07 +0000
commit7464fb74f38380683a4bd0265bde980dee8cfebd (patch)
tree37c10d1f6739f160251abd7fd777228eb7df8cc1
parent506345094f3da2759bab108b927709354c868399 (diff)
Update awk to June 12, 2020 version.
-rw-r--r--usr.bin/awk/FIXES11
-rw-r--r--usr.bin/awk/lib.c8
-rw-r--r--usr.bin/awk/main.c4
3 files changed, 18 insertions, 5 deletions
diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES
index 60fb568ddb6..bd39c55dd4f 100644
--- a/usr.bin/awk/FIXES
+++ b/usr.bin/awk/FIXES
@@ -1,4 +1,4 @@
-/* $OpenBSD: FIXES,v 1.33 2020/06/10 21:06:09 millert Exp $ */
+/* $OpenBSD: FIXES,v 1.34 2020/06/26 15:50:06 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -26,6 +26,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/usr.bin/awk/lib.c b/usr.bin/awk/lib.c
index 2d0d5511bfb..8da02dbff6c 100644
--- a/usr.bin/awk/lib.c
+++ b/usr.bin/awk/lib.c
@@ -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 @@ 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)
@@ -770,7 +773,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/usr.bin/awk/main.c b/usr.bin/awk/main.c
index 62b0d4c33dc..821ce3d5401 100644
--- a/usr.bin/awk/main.c
+++ b/usr.bin/awk/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.40 2020/06/13 01:19:55 millert Exp $ */
+/* $OpenBSD: main.c,v 1.41 2020/06/26 15:50:06 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -23,7 +23,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>