glibc/stdio-common/tst-fgets.c

21 lines
536 B
C
Raw Normal View History

/* Derived from the test case in
http://sourceware.org/bugzilla/show_bug.cgi?id=713. */
#include <stdio.h>
static int
do_test (void)
{
* posix/tst-execle1.c (do_test): Add a const. * posix/tst-execle2.c (do_test): Likewise. * posix/transbug.c (run_test): Add some casts. * posix/bug-regex22.c (main): Likewise. * posix/bug-regex5.c (main): Likewise. * wcsmbs/tst-mbsrtowcs.c (main): Likewise. * string/test-strspn.c (do_test, do_random_tests): Likewise. * string/test-strrchr.c (do_test, do_random_tests): Likewise. * string/test-strlen.c (do_random_tests): Likewise. * string/test-strpbrk.c (do_test, do_random_tests): Likewise. * string/test-strcmp.c (do_random_tests): Likewise. * string/test-strchr.c (do_test, do_random_tests): Likewise. * string/test-strcat.c (do_test, do_random_tests): Likewise. * string/test-strncpy.c (do_random_tests): Likewise. * string/test-strcpy.c (do_test, do_random_tests): Likewise. * string/test-memccpy.c (do_test): Likewise. * string/test-memmove.c (do_test, do_random_tests): Likewise. * string/test-memcpy.c (do_test, do_random_tests): Likewise. * string/test-memcmp.c (do_test, do_random_tests): Likewise. * string/test-memchr.c (do_test, do_random_tests): Likewise. * dlfcn/bug-atexit1.c (do_test): Fix up prototype in cast. * stdio-common/tst-fgets.c (do_test): Add a cast. * iconvdata/bug-iconv4.c (xiconv): Add a cast. * locale/programs/simple-hash.c (insert_entry_2): Remove useless casts. * resolv/herror.c (herror): Remove unused extern decl. * libio/obprintf.c: Include "strfile.h". * elf/order2mod2.c (init): Cast ignored value to void. * stdio-common/tstdiomisc.c: If FLT_EVAL_METHOD is 2, use long
2005-12-27 23:50:12 +01:00
FILE *fp = fmemopen ((char *) "hello", 5, "r");
char buf[2];
char *bp = fgets (buf, sizeof (buf), fp);
printf ("fgets: %s\n", bp == buf ? "OK" : "ERROR");
int res = bp != buf;
bp = fgets_unlocked (buf, sizeof (buf), fp);
printf ("fgets_unlocked: %s\n", bp == buf ? "OK" : "ERROR");
res |= bp != buf;
return res;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"