getline, getdelim: fix issues, extend tests
With these changes, getline()
and getdelim()
should work as expected, test for as many errors and crash conditions as is still sensible, and have an extensive test collections which should cover most of the behavior explicitly mentioned in https://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html . There are probably FILE-related interactions which I overlooked, but I am in no way a POSIX expert.
The tests produce the same result and expect files on my systems glibc (with the exception of the cases in which we do additional error handling, which is switched on or off via a macro).