Merge branch 'fix-RS' of https://github.com/mpinjr/awk into staging
This commit is contained in:
commit
30fb6ef0da
1
lib.c
1
lib.c
@ -176,6 +176,7 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record *
|
|||||||
infile = stdin;
|
infile = stdin;
|
||||||
else if ((infile = fopen(file, "r")) == NULL)
|
else if ((infile = fopen(file, "r")) == NULL)
|
||||||
FATAL("can't open file %s", file);
|
FATAL("can't open file %s", file);
|
||||||
|
innew = true;
|
||||||
setfval(fnrloc, 0.0);
|
setfval(fnrloc, 0.0);
|
||||||
}
|
}
|
||||||
c = readrec(&buf, &bufsize, infile, innew);
|
c = readrec(&buf, &bufsize, infile, innew);
|
||||||
|
@ -195,6 +195,24 @@ aa1a2a
|
|||||||
EOF
|
EOF
|
||||||
diff foo1 foo2 || echo 'BAD: T.misc ^regex reapplied fails'
|
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
|
# The following should not produce a warning about changing a constant
|
||||||
# nor about a curdled tempcell list
|
# nor about a curdled tempcell list
|
||||||
$awk 'function f(x) { x = 2 }
|
$awk 'function f(x) { x = 2 }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user