summaryrefslogtreecommitdiff
path: root/libc/stdio-common/bug18.c
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:30:44 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:30:44 +0000
commitaeaf46b3c97d332af954c1cf848ff0c96c10e753 (patch)
tree9a15b32e0f32fd77f19f23b8038d70f073bb4a79 /libc/stdio-common/bug18.c
parente90ab566778c1419050621c93f66b5e42da3d966 (diff)
downloadeglibc2-aeaf46b3c97d332af954c1cf848ff0c96c10e753.tar.gz
Merge changes between r2277 and r3468 from /fsf/glibc-2_6-branch.
git-svn-id: svn://svn.eglibc.org/branches/eglibc-2_6@3469 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/stdio-common/bug18.c')
-rw-r--r--libc/stdio-common/bug18.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/libc/stdio-common/bug18.c b/libc/stdio-common/bug18.c
new file mode 100644
index 000000000..2e4c378c1
--- /dev/null
+++ b/libc/stdio-common/bug18.c
@@ -0,0 +1,48 @@
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+
+#ifndef CHAR
+# define CHAR char
+# define L(str) str
+# define SSCANF sscanf
+#endif
+
+
+static int
+do_test (void)
+{
+ printf("setting errno to EINTR\n");
+ errno = EINTR;
+
+ printf("checking sscanf\n");
+
+ CHAR str[] = L("7-11");
+ int i, j, n;
+
+ i = j = n = 0;
+ SSCANF (str, L(" %i - %i %n"), &i, &j, &n);
+ printf ("found %i-%i (length=%i)\n", i, j, n);
+
+ int result = 0;
+ if (i != 7)
+ {
+ printf ("i is %d, expected 7\n", i);
+ result = 1;
+ }
+ if (j != 11)
+ {
+ printf ("j is %d, expected 11\n", j);
+ result = 1;
+ }
+ if (n != 4)
+ {
+ printf ("n is %d, expected 4\n", j);
+ result = 1;
+ }
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"