diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2022-06-03 19:42:28 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2022-06-03 19:42:28 +0000 |
commit | e8c201f0e16fe9d819598b3983089d1423a8d297 (patch) | |
tree | 8cc1ee4c4d36c882614c6277e2c4409fbff6d59a /usr.bin | |
parent | 85b7799ea07c7cec372903199173becc6afdbd37 (diff) |
The fulfillment of an assignment operand had been truncating its
entry in ARGV (since circa 1989). From Miguel Pineiro Jr.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/awk/FIXES | 7 | ||||
-rw-r--r-- | usr.bin/awk/lib.c | 6 | ||||
-rw-r--r-- | usr.bin/awk/main.c | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES index 17115123f0d..77fa8227e51 100644 --- a/usr.bin/awk/FIXES +++ b/usr.bin/awk/FIXES @@ -1,4 +1,4 @@ -/* $OpenBSD: FIXES,v 1.44 2022/06/03 19:40:56 millert Exp $ */ +/* $OpenBSD: FIXES,v 1.45 2022/06/03 19:42:27 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -26,6 +26,11 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Mar 14, 2022: + The fulfillment of an assignment operand had been truncating its + entry in ARGV (since circa 1989). Thanks to Miguel Pineiro Jr. + <mpj@pineiro.cc>. + Mar 3, 2022: Fixed file management memory leak that appears to have been there since the files array was first initialized with stdin, diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index 752b66d9a8d..0b58ed55e5a 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.47 2021/11/02 15:29:41 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.48 2022/06/03 19:42:27 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -295,12 +295,13 @@ char *getargv(int n) /* get ARGV[n] */ void setclvar(char *s) /* set var=value from s */ { - char *p; + char *e, *p; Cell *q; double result; for (p=s; *p != '='; p++) ; + e = p; *p++ = 0; p = qstring(p, '\0'); q = setsymtab(s, p, 0.0, STR, symtab); @@ -310,6 +311,7 @@ void setclvar(char *s) /* set var=value from s */ q->tval |= NUM; } DPRINTF("command line set %s to |%s|\n", s, p); + *e = '='; } diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index f3a3fe423dc..e1aef4a6b30 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.52 2022/06/03 19:40:56 millert Exp $ */ +/* $OpenBSD: main.c,v 1.53 2022/06/03 19:42:27 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 20220303"; +const char *version = "version 20220314"; #define DEBUG #include <stdio.h> |