ref: 30fb6ef0da1f33473637a711381b58961331dc5f
parent: d54b703cae9c5e7d5cf0f251bc847d38a70170c4
parent: feaf62d159df0f26dfbd18d03ef428ce3ded812d
author: ozan yigit <ozan.yigit@gmail.com>
date: Sat Jul 24 11:06:21 EDT 2021
Merge branch 'fix-RS' of https://github.com/mpinjr/awk into staging
--- a/lib.c
+++ b/lib.c
@@ -176,6 +176,7 @@
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);
--- a/testdir/T.misc
+++ b/testdir/T.misc
@@ -195,6 +195,24 @@
EOF
diff foo1 foo2 || echo 'BAD: T.misc ^regex reapplied fails'
+# ^-anchored RS matching should be active at the start of each input file
+tee foo1 foo2 >foo3 << \EOF
+aaa
+EOF
+$awk 1 RS='^a' foo1 foo2 foo3 >foo4
+cat << \EOF > foo5
+
+aa
+
+
+aa
+
+
+aa
+
+EOF
+diff foo4 foo5 || echo 'BAD: T.misc ^RS matches the start of every input file fails'
+
# The following should not produce a warning about changing a constant
# nor about a curdled tempcell list
$awk 'function f(x) { x = 2 }--
⑨