Blame stdio-common/tst-fgets.c
|
Packit |
6c4009 |
/* Derived from the test case in
|
|
Packit |
6c4009 |
https://sourceware.org/bugzilla/show_bug.cgi?id=713. */
|
|
Packit |
6c4009 |
#include <stdio.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
static int
|
|
Packit |
6c4009 |
do_test (void)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
FILE *fp = fmemopen ((char *) "hello", 5, "r");
|
|
Packit |
6c4009 |
char buf[2];
|
|
Packit |
6c4009 |
char *bp = fgets (buf, sizeof (buf), fp);
|
|
Packit |
6c4009 |
printf ("fgets: %s\n", bp == buf ? "OK" : "ERROR");
|
|
Packit |
6c4009 |
int res = bp != buf;
|
|
Packit |
6c4009 |
bp = fgets_unlocked (buf, sizeof (buf), fp);
|
|
Packit |
6c4009 |
printf ("fgets_unlocked: %s\n", bp == buf ? "OK" : "ERROR");
|
|
Packit |
6c4009 |
res |= bp != buf;
|
|
Packit |
6c4009 |
return res;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define TEST_FUNCTION do_test ()
|
|
Packit |
6c4009 |
#include "../test-skeleton.c"
|