Update from main archive 960811
[glibc/history.git] / stdio-common / bug10.c
blob3e1477dca17b8f45df073cbab1106048974eead2
1 #include <stdio.h>
2 int main(int arc, char *argv)
4 int n, res;
5 unsigned int val;
6 char *s;
7 int result = 0;
9 s = "111";
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;