summaryrefslogtreecommitdiff
path: root/REORG.TODO/stdio-common/bug10.c
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/stdio-common/bug10.c')
-rw-r--r--REORG.TODO/stdio-common/bug10.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/REORG.TODO/stdio-common/bug10.c b/REORG.TODO/stdio-common/bug10.c
new file mode 100644
index 0000000000..c4f328d4cb
--- /dev/null
+++ b/REORG.TODO/stdio-common/bug10.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+
+int
+main (int arc, char *argv[])
+{
+ int n, res;
+ unsigned int val;
+ char s[] = "111";
+ int result = 0;
+
+ n = 0;
+ res = sscanf(s, "%u %n", &val, &n);
+
+ printf("Result of sscanf = %d\n", res);
+ printf("Scanned format %%u = %u\n", val);
+ printf("Possibly scanned format %%n = %d\n", n);
+ result |= res != 1 || val != 111 || n != 3;
+
+
+ result |= sscanf ("", " %n", &n) == EOF;
+
+ puts (result ? "Test failed" : "All tests passed");
+
+ return result;
+}