6 check (FILE *fp, off_t o)
21 printf ("position = %lu, not %lu\n", (unsigned long int) ftello (fp),
22 (unsigned long int) o);
32 FILE *fp = tmpfile ();
35 puts ("tmpfile failed");
38 if (check (fp, 0) != 0)
41 puts ("going to write");
42 if (fputs ("hello", fp) == EOF)
44 puts ("fputs failed");
47 if (check (fp, 5) != 0)
50 puts ("going to rewind");
52 if (check (fp, 0) != 0)
55 puts ("going to read char");
59 printf ("read %c, not %c\n", c, 'h');
62 if (check (fp, 1) != 0)
65 puts ("going to put back");
66 if (ungetc (' ', fp) == EOF)
68 puts ("ungetc failed");
71 if (check (fp, 0) != 0)
74 puts ("going to write again");
75 if (fputs ("world", fp) == EOF)
77 puts ("2nd fputs failed");
80 if (check (fp, 5) != 0)
83 puts ("going to rewind again");
85 if (check (fp, 0) != 0)
90 puts ("fclose failed");
97 #define TEST_FUNCTION do_test ()
98 #include "../test-skeleton.c"