Corinna Vinschen writes:
Oh, and a plain C testcase, of course...
Call that fflush.c:
--8<---------------cut here---------------start------------->8---
#include <stdio.h>
int
main(int argc, char **argv)
{
char buf[1024];
int i;
char *bp = buf;
while (1) {
while ((i = getc(stdin)) != -1
&& (*bp++ = i) != '\n'
&& bp < &buf[1024])
/* DO NOTHING */ ;
*bp = '\0';
fprintf(stdout, "%s", buf);
fflush(NULL);
if (i == -1)
return 0;
bp = buf;
}
}
--8<---------------cut here---------------end--------------->8---
Then run:
gcc fflush.c -o fflush
cat fflush.c | ./fflush 2>/dev/null > fflush.out
diff fflush.c fflush.out
If things are working, fflush.c and fflush.out should be identical.
Currently only the first line makes it into fflush.out on Cygwin.