]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - stdio-common/bug5.c
Prepare vfscanf to use __strtof128_internal
[thirdparty/glibc.git] / stdio-common / bug5.c
index 18f069ae291aabffc76245ff6f0f4dcaf816a2a0..7bfe9b2b8d8fa1520537dc8a681b8ce6f6c685fb 100644 (file)
@@ -3,7 +3,6 @@
    exhibits itself, outfile will be missing the 2nd through 1023rd
    characters.  */
 
-#include <ansidecl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 static char buf[8192];
 
 int
-DEFUN_VOID(main)
+main (void)
 {
   FILE *in;
   FILE *out;
-  static char inname[] = "/tmp/bug5.in";
-  static char outname[] = "/tmp/bug5.out";
-  int i;
+  static char inname[] = OBJPFX "bug5test.in";
+  static char outname[] = OBJPFX "bug5test.out";
+  char *printbuf;
+  size_t i;
+  int result;
 
   /* Create a test file.  */
   in = fopen (inname, "w+");
@@ -27,7 +28,7 @@ DEFUN_VOID(main)
       return 1;
     }
   for (i = 0; i < 1000; ++i)
-    fprintf (in, "%d\n", i);
+    fprintf (in, "%Zu\n", i);
 
   out = fopen (outname, "w");
   if (out == NULL)
@@ -54,7 +55,15 @@ DEFUN_VOID(main)
 
   puts ("There should be no further output from this test.");
   fflush (stdout);
-  execlp ("cmp", "cmp", inname, outname, (char *) NULL);
-  perror ("execlp: cmp");
-  exit (1);
+
+  /* We must remove this entry to assure the `cmp' binary does not use
+     the perhaps incompatible new shared libraries.  */
+  unsetenv ("LD_LIBRARY_PATH");
+
+  asprintf (&printbuf, "cmp %s %s", inname, outname);
+  result = system (printbuf);
+  remove (inname);
+  remove (outname);
+
+  exit ((result != 0));
 }