Back to index

glibc  2.9
tst-fgets.c
Go to the documentation of this file.
00001 /* Derived from the test case in
00002    http://sourceware.org/bugzilla/show_bug.cgi?id=713.  */
00003 #include <stdio.h>
00004 
00005 static int
00006 do_test (void)
00007 {
00008   FILE *fp = fmemopen ((char *) "hello", 5, "r");
00009   char buf[2];
00010   char *bp = fgets (buf, sizeof (buf), fp);
00011   printf ("fgets: %s\n", bp == buf ? "OK" : "ERROR");
00012   int res = bp != buf;
00013   bp = fgets_unlocked (buf, sizeof (buf), fp);
00014   printf ("fgets_unlocked: %s\n", bp == buf ? "OK" : "ERROR");
00015   res |= bp != buf;
00016   return res;
00017 }
00018 
00019 #define TEST_FUNCTION do_test ()
00020 #include "../test-skeleton.c"