1 /* If stdio is working correctly, after this is run infile and outfile
2 will have the same contents. If the bug (found in GNU C library 0.3)
3 exhibits itself, outfile will be missing the 2nd through 1023rd
11 static char buf
[8192];
18 static char inname
[] = "/tmp/bug5.in";
19 static char outname
[] = "/tmp/bug5.out";
22 /* Create a test file. */
23 in
= fopen (inname
, "w+");
29 for (i
= 0; i
< 1000; ++i
)
30 fprintf (in
, "%d\n", i
);
32 out
= fopen (outname
, "w");
38 if (fseek (in
, 0L, SEEK_SET
) != 0)
40 putc (getc (in
), out
);
41 i
= fread (buf
, 1, sizeof (buf
), in
);
47 if (fwrite (buf
, 1, i
, out
) != i
)
55 puts ("There should be no further output from this test.");
57 execlp ("cmp", "cmp", inname
, outname
, (char *) NULL
);
58 perror ("execlp: cmp");