tests: replace system by xsystem
[glibc.git] / stdio-common / bug19.c
blob9a3deac3fc7c89b8a69813c7759cbea5011ac047
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;
32 int result = 0;
34 i = j = n = 0;
35 if (FSCANF (fp, L(" %i - %i %n"), &i, &j, &n) < 2)
37 printf ("FSCANF couldn't read all parameters %d\n", errno);
38 result = 1;
41 printf ("found %i-%i (length=%i)\n", i, j, n);
43 if (i != 7)
45 printf ("i is %d, expected 7\n", i);
46 result = 1;
48 if (j != 11)
50 printf ("j is %d, expected 11\n", j);
51 result = 1;
53 if (n != 4)
55 printf ("n is %d, expected 4\n", j);
56 result = 1;
59 return result;
62 #define TEST_FUNCTION do_test ()
63 #include "../test-skeleton.c"