From 0a102a4532d3c0c03c930590b30513cd98a0ae6b Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 19 Apr 2021 14:08:55 +0000 Subject: [PATCH] RS ^-anchoring needs to know if it's reading the first record of a file. Without this fix, when reading the first record of an input file named on the command line, the regular expression engine will be misconfigured, precluding a successful match. From Miguel Pineiro Jr --- usr.bin/awk/lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index 8cbdd6d29c6..6ae55dab4f4 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.44 2020/12/18 21:36:24 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.45 2021/04/19 14:08:55 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -174,6 +174,7 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record * infile = stdin; else if ((infile = fopen(file, "r")) == NULL) FATAL("can't open file %s", file); + innew = true; setfval(fnrloc, 0.0); } c = readrec(&buf, &bufsize, infile, innew); -- 2.20.1