libio/bug-wsetpos: Make the error message match the causing function
[glibc.git] / stdio-common / bug3.c
blobdeabd0057290e64bcecfcecb26a9ae12670fe1a5
1 #include <stdio.h>
2 #include <string.h>
4 #include <support/xstdio.h>
6 int
7 main (void)
9 FILE *f;
10 int i;
11 const char filename[] = OBJPFX "bug3.test";
13 f = fopen(filename, "w+");
14 for (i=0; i<9000; i++)
15 putc ('x', f);
16 fseek (f, 8180L, 0);
17 fwrite ("Where does this text go?", 1, 24, f);
18 fflush (f);
20 rewind (f);
21 for (i=0; i<9000; i++)
23 int j;
25 if ((j = getc(f)) != 'x')
27 if (i != 8180)
29 printf ("Test FAILED!");
30 return 1;
32 else
34 char buf[25];
36 buf[0] = j;
37 xfread (buf + 1, 1, 23, f);
38 buf[24] = '\0';
39 if (strcmp (buf, "Where does this text go?") != 0)
41 printf ("%s\nTest FAILED!\n", buf);
42 return 1;
44 i += 23;
49 fclose(f);
50 remove(filename);
52 puts ("Test succeeded.");
54 return 0;