aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/tstdiomisc.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-12-06 00:14:32 +0000
committerRoland McGrath <roland@gnu.org>1995-12-06 00:14:32 +0000
commit196980f5117c8d38f10d64bf67eeb0924651675f (patch)
tree4e2a731a1f766ee63e1038d7f38bee3db8c78a2c /stdio-common/tstdiomisc.c
parent77a58cad3fa0a286bd2581187a2463a762d711ba (diff)
downloadglibc-196980f5117c8d38f10d64bf67eeb0924651675f.tar
glibc-196980f5117c8d38f10d64bf67eeb0924651675f.tar.gz
glibc-196980f5117c8d38f10d64bf67eeb0924651675f.tar.bz2
glibc-196980f5117c8d38f10d64bf67eeb0924651675f.zip
Updated from ../gpl2lgpl.sed /home/gd/gnu/lib/error.c
Diffstat (limited to 'stdio-common/tstdiomisc.c')
-rw-r--r--stdio-common/tstdiomisc.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
new file mode 100644
index 0000000000..0bd5515934
--- /dev/null
+++ b/stdio-common/tstdiomisc.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+
+void
+t1 ()
+{
+ int n = -1;
+ sscanf ("abc ", "abc %n", &n);
+ printf ("t1: count=%d\n", n);
+}
+
+void
+t2 ()
+{
+ int n;
+ long N;
+ int retval;
+#define SCAN(INPUT, FORMAT, VAR) \
+ VAR = -1; \
+ retval = sscanf (INPUT, FORMAT, &VAR); \
+ printf ("sscanf (\"%s\", \"%s\", &x) => %d, x = %ld\n", \
+ INPUT, FORMAT, retval, VAR);
+
+ SCAN ("12345", "%ld", N);
+ SCAN ("12345", "%llllld", N);
+ SCAN ("12345", "%LLLLLd", N);
+ SCAN ("test ", "%*s%n", n);
+ SCAN ("test ", "%2*s%n", n);
+ SCAN ("12 ", "%l2d", n);
+ SCAN ("12 ", "%2ld", N);
+}
+
+int
+main ()
+{
+ t1 ();
+ t2 ();
+
+ fflush (stdout);
+ return 0;
+}