Quash warning in s_sincosl.
[platform/upstream/glibc.git] / stdio-common / bug4.c
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <string.h>
4
5 int stdio_block_read = 1, stdio_block_write = 1;
6
7 int
8 main (int argc, char *argv[])
9 {
10   FILE *f;
11   int i;
12   char buffer[31];
13   const char filename[] = "/tmp/bug4.test";
14
15   while ((i = getopt (argc, argv, "rw")) != -1)
16     switch (i)
17       {
18       case 'r':
19         stdio_block_read = 0;
20         break;
21       case 'w':
22         stdio_block_write = 0;
23         break;
24       }
25
26   f = fopen (filename, "w+");
27   for (i = 0; i < 9000; ++i)
28     putc('x', f);
29
30   fseek (f, 8180L, 0);
31   fwrite ("Where does this text come from?", 1, 31, f);
32   fseek (f, 8180L, 0);
33   fread (buffer, 1, 31, f);
34   fwrite (buffer, 1, 31, stdout);
35   fclose (f);
36   remove (filename);
37
38   if (!memcmp (buffer, "Where does this text come from?", 31))
39     {
40       puts ("\nTest succeeded.");
41       return 0;
42     }
43   else
44     {
45       puts ("\nTest FAILED!");
46       return 1;
47     }
48 }