Make unistd.h pre-c((-safe.
[glibc.git] / stdio-common / tst-fgets.c
blob0aa9030e3ae7b845e2df420dc98efc1b759f477e
1 /* Derived from the test case in
2 http://sourceware.org/bugzilla/show_bug.cgi?id=713. */
3 #include <stdio.h>
5 static int
6 do_test (void)
8 FILE *fp = fmemopen ((char *) "hello", 5, "r");
9 char buf[2];
10 char *bp = fgets (buf, sizeof (buf), fp);
11 printf ("fgets: %s\n", bp == buf ? "OK" : "ERROR");
12 int res = bp != buf;
13 bp = fgets_unlocked (buf, sizeof (buf), fp);
14 printf ("fgets_unlocked: %s\n", bp == buf ? "OK" : "ERROR");
15 res |= bp != buf;
16 return res;
19 #define TEST_FUNCTION do_test ()
20 #include "../test-skeleton.c"