7 static int do_test (void);
8 #define TEST_FUNCTION do_test ()
9 #include <test-skeleton.c>
21 buf = (char *) malloc (strlen (test_dir) + sizeof "/tst-eof.XXXXXX");
24 printf ("cannot allocate memory: %m\n");
27 stpcpy (stpcpy (buf, test_dir), "/tst-eof.XXXXXX");
32 printf ("cannot open temporary file: %m\n");
36 /* Make sure it gets removed. */
39 if (write (fd, "some string\n", 12) != 12)
41 printf ("cannot write temporary file: %m\n");
45 if (lseek (fd, 0, SEEK_SET) == (off_t) -1)
47 printf ("cannot reposition temporary file: %m\n");
51 fp = fdopen (fd, "r");
54 printf ("cannot create stream: %m\n");
60 puts ("EOF set after fdopen");
64 if (fread (buf, 1, 20, fp) != 12)
66 puts ("didn't read the correct number of bytes");
72 puts ("EOF not set after fread");