about summary refs log tree commit diff
path: root/stdio-common/bug9.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/bug9.c')
-rw-r--r--stdio-common/bug9.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/stdio-common/bug9.c b/stdio-common/bug9.c
new file mode 100644
index 0000000000..5a7166ce90
--- /dev/null
+++ b/stdio-common/bug9.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <string.h>
+
+int
+main()
+{
+  char buf[100];
+  int a, b;
+  int status = 0;
+
+  sscanf ("12ab", "%dab%n", &a, &b);
+  sprintf (buf, "%d, %d", a, b);
+  puts (buf);
+  status |= strcmp (buf, "12, 4");
+
+  sscanf ("12ab100", "%dab%n100", &a, &b);
+  sprintf (buf, "%d, %d", a, b);
+  puts (buf);
+  status |= strcmp (buf, "12, 4");
+
+  return status;
+}