Fix x86-64 build without multiarch.
[glibc.git] / stdio-common / bug19.c
blobe083304bda40efb4cb2f4c27d4d2d025164f5ad7
1 #include <assert.h>
2 #include <errno.h>
3 #include <stdio.h>
5 #ifndef CHAR
6 # define CHAR char
7 # define L(str) str
8 # define FPUTS fputs
9 # define FSCANF fscanf
10 #endif
13 static int
14 do_test (void)
16 FILE *fp = tmpfile ();
17 if (fp == NULL)
19 puts ("cannot open file");
20 return 1;
23 FPUTS (L("7-11"), fp);
24 rewind (fp);
26 printf("setting errno to EINTR\n");
27 errno = EINTR;
29 printf("checking sscanf\n");
31 int i, j, n;
33 i = j = n = 0;
34 FSCANF (fp, L(" %i - %i %n"), &i, &j, &n);
35 printf ("found %i-%i (length=%i)\n", i, j, n);
37 int result = 0;
38 if (i != 7)
40 printf ("i is %d, expected 7\n", i);
41 result = 1;
43 if (j != 11)
45 printf ("j is %d, expected 11\n", j);
46 result = 1;
48 if (n != 4)
50 printf ("n is %d, expected 4\n", j);
51 result = 1;
54 return result;
57 #define TEST_FUNCTION do_test ()
58 #include "../test-skeleton.c"