]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdio-common/tst-fgets.c
Improve documentation for malloc etc. (BZ#27719)
[thirdparty/glibc.git] / stdio-common / tst-fgets.c
CommitLineData
b5d839c9 1/* Derived from the test case in
a306c790 2 https://sourceware.org/bugzilla/show_bug.cgi?id=713. */
b5d839c9
UD
3#include <stdio.h>
4
5static int
6do_test (void)
7{
0317eaec 8 FILE *fp = fmemopen ((char *) "hello", 5, "r");
b5d839c9
UD
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"