mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 03:10:05 +00:00
e66f63fb63
* stdio/bug4.c: Put temporary files in /tmp. * stdio/bug3.c: Likewise. * stdio/bug5.c: Likewise. * stdio/test-fseek.c: Likewise. * stdio/test-popen.c: Likewise.
53 lines
770 B
C
53 lines
770 B
C
#include <ansidecl.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
int
|
|
DEFUN_VOID(main)
|
|
{
|
|
FILE *f;
|
|
int i;
|
|
|
|
f = fopen("/tmp/bugtest", "w+");
|
|
for (i=0; i<9000; i++)
|
|
putc ('x', f);
|
|
fseek (f, 8180L, 0);
|
|
fwrite ("Where does this text go?", 1, 24, f);
|
|
fflush (f);
|
|
|
|
rewind (f);
|
|
for (i=0; i<9000; i++)
|
|
{
|
|
int j;
|
|
|
|
if ((j = getc(f)) != 'x')
|
|
{
|
|
if (i != 8180)
|
|
{
|
|
printf ("Test FAILED!");
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
char buf[25];
|
|
|
|
buf[0] = j;
|
|
fread (buf + 1, 1, 23, f);
|
|
buf[24] = '\0';
|
|
if (strcmp (buf, "Where does this text go?") != 0)
|
|
{
|
|
printf ("%s\nTest FAILED!\n", buf);
|
|
return 1;
|
|
}
|
|
i += 23;
|
|
}
|
|
}
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
puts ("Test succeeded.");
|
|
|
|
return 0;
|
|
}
|