build-many-glibcs.py: Add openrisc hard float glibc variant
[glibc.git] / stdio-common / tst-ferror.c
blob69592df048a628efc248e02d1ad5e6cf0e73bec1
1 #include <stdio.h>
3 static int
4 do_test (void)
6 char buf[100];
7 int result = 0;
9 if (ferror (stdin) != 0)
11 fputs ("error bit set for stdin at startup\n", stdout);
12 result = 1;
14 if (fgets (buf, sizeof buf, stdin) != buf)
16 fputs ("fgets with existing input has problem\n", stdout);
17 result = 1;
19 if (ferror (stdin) != 0)
21 fputs ("error bit set for stdin after setup\n", stdout);
22 result = 1;
24 if (fputc ('a', stdin) != EOF)
26 fputs ("fputc to stdin does not terminate with an error\n", stdout);
27 result = 1;
29 if (ferror (stdin) == 0)
31 fputs ("error bit not set for stdin after fputc\n", stdout);
32 result = 1;
34 clearerr (stdin);
35 if (ferror (stdin) != 0)
37 fputs ("error bit set for stdin after clearerr\n", stdout);
38 result = 1;
40 return result;
43 #define TEST_FUNCTION do_test ()
44 #include "../test-skeleton.c"