blob: 0aa9030e3ae7b845e2df420dc98efc1b759f477e [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* Derived from the test case in
2 http://sourceware.org/bugzilla/show_bug.cgi?id=713. */
3#include <stdio.h>
4
5static int
6do_test (void)
7{
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;
17}
18
19#define TEST_FUNCTION do_test ()
20#include "../test-skeleton.c"