10 static void prepare (void);
11 #define PREPARE(argc, argv) prepare ()
14 #define TEST_FUNCTION do_test ()
15 static int do_test (void);
16 #include "../test-skeleton.c"
22 fd
= create_temp_file ("wrewind.", &fname
);
35 fp
= fdopen (fd
, "w");
38 puts ("cannot create file");
42 if (fputs ("one\n", fp
) == EOF
|| fputs ("two\n", fp
) == EOF
)
44 puts ("cannot create filec content");
50 fp
= fopen (fname
, "a+");
53 puts ("cannot fopen a+");
57 if (fgets (buf
, sizeof (buf
), fp
) == NULL
)
59 puts ("cannot read after fopen a+");
63 if (strcmp (buf
, "one\n") != 0)
65 puts ("read after fopen a+ produced wrong result");
71 fd
= open (fname
, O_RDWR
);
78 fp
= fdopen (fd
, "a+");
81 puts ("fopen after open failed");
85 if (fgets (buf
, sizeof (buf
), fp
) == NULL
)
87 puts ("cannot read after fdopen a+");
91 if (strcmp (buf
, "one\n") != 0)
93 puts ("read after fdopen a+ produced wrong result");