Hi Andy and Ed.
I finally found some time to review this. Andy's patch is correct. I've
applied it and pushed the changes out.
Andy - thanks for the patch. In the future, can you include ChangeLog
entries in your proposed patches? Usually your patches are correct
(that's a complement :-), and it makes it easier to apply them if the
ChangeLog entries are already there.
Thanks for the report (Ed) and for the fix (Andy). I really appreciate it.
Andy's answers to the other questions are on target too. Non-redirected
getline in BEGINFILE/ENDFILE is invalid --> not allowed, gawk quits.
Inside END it's undefined meaning no guarantees about what's going to
happen. In general if you do
END { n = getline; print n }
you'll get 0 for end of file:
$ for i in nawk mawk mksawk 'busybox awk' gawk
> do echo ========= $i
> $i 'END { n = getline; print n }' /dev/null
> done
========= nawk
0
========= mawk
0
========= mksawk
0
========= busybox awk
Segmentation fault (core dumped)
========= gawk
0
Ooops. Looks like Busybox awk forgot a corner case. :-)
Arnold