summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/awk/FIXES6
-rw-r--r--usr.bin/awk/README.md15
-rw-r--r--usr.bin/awk/main.c4
-rw-r--r--usr.bin/awk/run.c25
4 files changed, 34 insertions, 16 deletions
diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES
index 16ed45f0bbc..faed16320ec 100644
--- a/usr.bin/awk/FIXES
+++ b/usr.bin/awk/FIXES
@@ -1,4 +1,4 @@
-/* $OpenBSD: FIXES,v 1.35 2020/06/26 15:57:39 millert Exp $ */
+/* $OpenBSD: FIXES,v 1.36 2020/07/02 19:06:22 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -26,6 +26,10 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
+July 2, 2020:
+ Merge PRs 85 and 86 which fix regressions. Thanks to
+ Tim van der Molen for the fixes.
+
June 25, 2020:
Merge PRs 82 and 84. The latter fixes issue #83. Thanks to
Todd Miller and awkfan77.
diff --git a/usr.bin/awk/README.md b/usr.bin/awk/README.md
index e147324171b..75e7305247c 100644
--- a/usr.bin/awk/README.md
+++ b/usr.bin/awk/README.md
@@ -1,4 +1,4 @@
-$OpenBSD: README.md,v 1.2 2020/06/10 21:05:50 millert Exp $
+$OpenBSD: README.md,v 1.3 2020/07/02 19:06:22 millert Exp $
# The One True Awk
@@ -106,5 +106,16 @@ astonishly slow. If `awk` seems slow, you might try fixing that.
More generally, turning on optimization can significantly improve
`awk`'s speed, perhaps by 1/3 for highest levels.
+## A Note About Maintenance
+
+NOTICE! Maintenance of this program is on a ``best effort''
+basis. We try to get to issues and pull requests as quickly
+as we can. Unfortunately, however, keeping this program going
+is not at the top of our priority list.
+
+_If_ you (yes, you!) are interested in taking over active maintenance of
+`awk`, please open an issue to indicate that fact, give a little bit of
+your background and some idea of your plans and dreams. Thanks!
+
#### Last Updated
-Wed Jan 1 22:44:38 IST 2020
+Thu Jul 2 21:39:31 IDT 2020
diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c
index 0ec21d40ddf..b36067bf516 100644
--- a/usr.bin/awk/main.c
+++ b/usr.bin/awk/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.42 2020/06/26 15:57:39 millert Exp $ */
+/* $OpenBSD: main.c,v 1.43 2020/07/02 19:06:22 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 20200625";
+const char *version = "version 20200702";
#define DEBUG
#include <stdio.h>
diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c
index 001c8476833..4ba6c79eac1 100644
--- a/usr.bin/awk/run.c
+++ b/usr.bin/awk/run.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: run.c,v 1.62 2020/07/01 13:32:27 millert Exp $ */
+/* $OpenBSD: run.c,v 1.63 2020/07/02 19:06:22 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -26,9 +26,9 @@ THIS SOFTWARE.
#define DEBUG
#include <stdio.h>
#include <ctype.h>
+#include <errno.h>
#include <wchar.h>
#include <wctype.h>
-#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#include <limits.h>
@@ -136,6 +136,7 @@ int adjbuf(char **pbuf, int *psiz, int minlen, int quantum, char **pbptr,
void run(Node *a) /* execution of parse tree starts here */
{
+
stdinit();
execute(a);
closeall();
@@ -925,8 +926,7 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
n = fmtwd;
adjbuf(&buf, &bufsize, 1+n+p-buf, recsize, &p, "format5");
switch (flag) {
- case '?': /* unknown, so dump it too */
- snprintf(p, BUFSZ(p), "%s", fmt);
+ case '?': snprintf(p, BUFSZ(p), "%s", fmt); /* unknown, so dump it too */
t = getsval(x);
n = strlen(t);
if (fmtwd > n)
@@ -1074,10 +1074,10 @@ Cell *arith(Node **a, int n) /* a[0] + a[1], etc. also -a[0] */
case POWER:
if (j >= 0 && modf(j, &v) == 0.0) /* pos integer exponent */
i = ipow(i, (int) j);
- else {
+ else {
errno = 0;
i = errcheck(pow(i, j), "pow");
- }
+ }
break;
default: /* can't happen */
FATAL("illegal arithmetic operator %d", n);
@@ -1170,10 +1170,10 @@ Cell *assign(Node **a, int n) /* a[0] = a[1], a[0] += a[1], etc. */
case POWEQ:
if (yf >= 0 && modf(yf, &v) == 0.0) /* pos integer exponent */
xf = ipow(xf, (int) yf);
- else {
+ else {
errno = 0;
xf = errcheck(pow(xf, yf), "pow");
- }
+ }
break;
default:
FATAL("illegal assignment operator %d", n);
@@ -1602,15 +1602,18 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis
break;
case FLOG:
errno = 0;
- u = errcheck(log(getfval(x)), "log"); break;
+ u = errcheck(log(getfval(x)), "log");
+ break;
case FINT:
modf(getfval(x), &u); break;
case FEXP:
errno = 0;
- u = errcheck(exp(getfval(x)), "exp"); break;
+ u = errcheck(exp(getfval(x)), "exp");
+ break;
case FSQRT:
errno = 0;
- u = errcheck(sqrt(getfval(x)), "sqrt"); break;
+ u = errcheck(sqrt(getfval(x)), "sqrt");
+ break;
case FSIN:
u = sin(getfval(x)); break;
case FCOS: