1 /* Test for ungetc bugs. */
9 fputs ("test failed: " #x "\n", stderr); \
15 main (int argc
, char *argv
[])
23 fp
= fopen (name
, "w");
29 fp
= fopen (name
, "r");
31 assert (ungetc ('z', fp
) == 'z');
32 assert (getc (fp
) == 'z');
33 assert (getc (fp
) == 'b');
34 assert (getc (fp
) == 'l');
35 assert (ungetc ('m', fp
) == 'm');
36 assert (getc (fp
) == 'm');
37 assert ((c
= getc (fp
)) == 'a');
38 assert (getc (fp
) == EOF
);
39 assert (ungetc (c
, fp
) == c
);
40 assert (feof (fp
) == 0);
41 assert (getc (fp
) == c
);
42 assert (getc (fp
) == EOF
);