| 1 | /* Derived from the test case in |
|---|---|
| 2 | https://sourceware.org/bugzilla/show_bug.cgi?id=713. */ |
| 3 | #include <stdio.h> |
| 4 | |
| 5 | static int |
| 6 | do_test (void) |
| 7 | { |
| 8 | FILE *fp = fmemopen ((char *) "hello", 5, "r"); |
| 9 | char buf[2]; |
| 10 | char *bp = fgets (s: buf, n: sizeof (buf), stream: fp); |
| 11 | printf (format: "fgets: %s\n", bp == buf ? "OK": "ERROR"); |
| 12 | int res = bp != buf; |
| 13 | bp = fgets_unlocked (buf, sizeof (buf), fp); |
| 14 | printf (format: "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" |
| 21 |
