Update to 2.1.x development version
[glibc/history.git] / stdio-common / bug10.c
blob3e15526a43fc7520b5d66972b9849062b13f49dd
1 #include <stdio.h>
3 int
4 main (int arc, char *argv)
6 int n, res;
7 unsigned int val;
8 char s[] = "111";
9 int result = 0;
11 n = 0;
12 res = sscanf(s, "%u %n", &val, &n);
14 printf("Result of sscanf = %d\n", res);
15 printf("Scanned format %%u = %u\n", val);
16 printf("Possibly scanned format %%n = %d\n", n);
17 result |= res != 1 || val != 111 || n != 3;
20 result |= sscanf ("", " %n", &n) == EOF;
22 puts (result ? "Test failed" : "All tests passed");
24 return result;