Fix invalid escape sequence in build-many-glibcs.py
[glibc.git] / stdio-common / bug4.c
blob4059ff75b3df916a1ed1f1895d95c3101ba00a41
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <string.h>
5 #include <support/xstdio.h>
7 int stdio_block_read = 1, stdio_block_write = 1;
9 int
10 main (int argc, char *argv[])
12 FILE *f;
13 int i;
14 char buffer[31];
15 const char filename[] = OBJPFX "bug4.test";
17 while ((i = getopt (argc, argv, "rw")) != -1)
18 switch (i)
20 case 'r':
21 stdio_block_read = 0;
22 break;
23 case 'w':
24 stdio_block_write = 0;
25 break;
28 f = fopen (filename, "w+");
29 for (i = 0; i < 9000; ++i)
30 putc('x', f);
32 fseek (f, 8180L, 0);
33 fwrite ("Where does this text come from?", 1, 31, f);
34 fseek (f, 8180L, 0);
35 xfread (buffer, 1, 31, f);
36 fwrite (buffer, 1, 31, stdout);
37 fclose (f);
38 remove (filename);
40 if (!memcmp (buffer, "Where does this text come from?", 31))
42 puts ("\nTest succeeded.");
43 return 0;
45 else
47 puts ("\nTest FAILED!");
48 return 1;