CFLAGS-_itoa.c = -Wno-unused
CFLAGS-tst-printf.c = -Wno-format
+
+ifeq ($(stdio),libio)
+ifneq (,$(filter %REENTRANT, $(defines)))
+CPPFLAGS += -D_IO_MTSAFE_IO
+endif
+endif
{
FILE *f;
int i;
+ const char filename[] = "/tmp/bugtest";
- f = fopen("/tmp/bugtest", "w+");
+ f = fopen(filename, "w+");
for (i=0; i<9000; i++)
putc ('x', f);
fseek (f, 8180L, 0);
}
fclose(f);
+ remove(filename);
puts ("Test succeeded.");
FILE *f;
int i;
char buffer[31];
+ const char filename[] = "/tmp/bugtest";
while ((i = getopt (argc, argv, "rw")) != EOF)
switch (i)
break;
}
- f = fopen("/tmp/bugtest", "w+");
+ f = fopen(filename, "w+");
for (i=0; i<9000; i++) {
putc('x', f);
}
fread(buffer, 1, 31, f);
fwrite(buffer, 1, 31, stdout);
fclose(f);
+ remove(filename);
if (!memcmp (buffer, "Where does this text come from?", 31))
{
FILE *out;
static char inname[] = "/tmp/bug5.in";
static char outname[] = "/tmp/bug5.out";
- int i;
+ char *printbuf;
+ int i, result;
/* Create a test file. */
in = fopen (inname, "w+");
puts ("There should be no further output from this test.");
fflush (stdout);
- execlp ("cmp", "cmp", inname, outname, (char *) NULL);
- perror ("execlp: cmp");
- exit (1);
+
+ asprintf (&printbuf, "cmp %s %s", inname, outname);
+ result = system (printbuf);
+ remove (inname);
+ remove (outname);
+
+ exit ((result != 0));
}
n = -1;
ret = sscanf ("1000", "%lld", &n);
- printf ("%%lld: ret: %d, n: %Ld, c: %c\n", ret, n);
+ printf ("%%lld: ret: %d, n: %Ld\n", ret, n);
if (ret != 1 || n != 1000L)
abort ();
rstatus = pclose (input);
printf ("reading pclose returned %d\n", rstatus);
+ remove ("/tmp/tstpopen.tmp");
+
puts (wstatus | rstatus ? "Test FAILED!" : "Test succeeded.");
exit (wstatus | rstatus);
}
-
-
-
-
struct {
const char * in, * out, * resolved;
- int errno;
+ int error;
} tests[] = {
/* 0 */
{"/", "/"},
continue;
}
- if (!tests[i].out && errno != tests[i].errno)
+ if (!tests[i].out && errno != tests[i].error)
{
printf ("%s: flunked test %d (expected errno %d, got %d)\n",
- argv[0], i, tests[i].errno, errno);
+ argv[0], i, tests[i].errno, error);
++errors;
continue;
}