Merge branch 'fix-RS' of https://github.com/mpinjr/awk into staging

This commit is contained in:
ozan yigit 2021-07-24 15:06:21 -04:00
commit 30fb6ef0da
2 changed files with 19 additions and 0 deletions

1
lib.c
View File

@ -176,6 +176,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);

View File

@ -195,6 +195,24 @@ aa1a2a
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 }