1 /* Test program for bug in wide streams. */
6 #include <support/xunistd.h>
8 static void do_prepare (void);
9 #define PREPARE(argc, argv) do_prepare ()
10 static int do_test (void);
11 #define TEST_FUNCTION do_test ()
12 #include <test-skeleton.c>
14 static char *temp_file
;
19 int fd
= create_temp_file ("bug-ungetc.", &temp_file
);
22 printf ("cannot create temporary file: %m\n");
32 FILE *f
= fopen (temp_file
, "r+");
36 printf ("fopen: %m\n");
41 //#define fwscanf fscanf
42 //#define fwprintf fprintf
45 if (fwscanf (f
, L_("%d!"), &i
) != 1)
47 printf ("fwscanf failed\n");
54 printf ("rewind: %m\n");
58 if (fputws (L_("1!"), f
) == EOF
)
60 printf ("fputws: %m\n");
66 printf ("fflush: %m\n");
72 printf ("fclose: %m\n");
76 puts ("Test succeeded.");