aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/tst-sprintf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-05-21 18:23:50 +0000
committerUlrich Drepper <drepper@redhat.com>2007-05-21 18:23:50 +0000
commitaf269dd9541f881695ac27ad951c094b8dbd4738 (patch)
treebdf376bd4c205c886ba088ba94b80f80ac391ada /stdio-common/tst-sprintf.c
parent1f4843fbffccebc60f85b1e1a48711d4fb9ab210 (diff)
downloadglibc-af269dd9541f881695ac27ad951c094b8dbd4738.tar
glibc-af269dd9541f881695ac27ad951c094b8dbd4738.tar.gz
glibc-af269dd9541f881695ac27ad951c094b8dbd4738.tar.bz2
glibc-af269dd9541f881695ac27ad951c094b8dbd4738.zip
[BZ #4514]
* stdio-common/vfprintf.c (vfprintf): Don't shadow workstart variable, reinitialize workend at the start of each do_positional format spec loop, free workstart before do_positional loops. (printf_unknown): Fix size of work_buffer. * stdio-common/tst-sprintf.c (main): Add 3 new testcases.
Diffstat (limited to 'stdio-common/tst-sprintf.c')
-rw-r--r--stdio-common/tst-sprintf.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c
index c61d3b50e4..c04fef18f4 100644
--- a/stdio-common/tst-sprintf.c
+++ b/stdio-common/tst-sprintf.c
@@ -37,5 +37,26 @@ main (void)
free (dst);
}
+ if (sprintf (buf, "%1$d%3$.*2$s%4$d", 7, 67108863, "x", 8) != 3
+ || strcmp (buf, "7x8") != 0)
+ {
+ printf ("sprintf (buf, \"%%1$d%%3$.*2$s%%4$d\", 7, 67108863, \"x\", 8) produced `%s' output", buf);
+ result = 1;
+ }
+
+ if (sprintf (buf, "%67108863.16\"%d", 7) != 14
+ || strcmp (buf, "%67108863.16\"7") != 0)
+ {
+ printf ("sprintf (buf, \"%%67108863.16\\\"%%d\", 7) produced `%s' output", buf);
+ result = 1;
+ }
+
+ if (sprintf (buf, "%*\"%d", 0x3ffffff, 7) != 11
+ || strcmp (buf, "%67108863\"7") != 0)
+ {
+ printf ("sprintf (buf, \"%%*\\\"%%d\", 0x3ffffff, 7) produced `%s' output", buf);
+ result = 1;
+ }
+
return result;
}