On Mon, Jun 15, 2015 at 03:27:37PM -0400, Wolfgang Corcoran-Mathe wrote:
> The original flush-stdin loop (with fgets()) hung until the user
> entered some extraneous characters for it to kill.
I don't know if it is related or not, but I'm having a similar problem
with glibc. See this code:
int
main(void)
{
getchar();
getchar();
return 0;
}
If the user writes a ctrl-d in the first getchar, then the second
getchar blocks until the user writes something else, although the
file already reached the end of file. I have tested it in NetBSD
to, and the second getchar returns automatically with EOF. I
don't know what is said in the C standard, but I think this is an
error in glibc.
Regards,