From 715a900c9085907fa749589bf738b192b1a2bda5 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 28 Sep 2012 12:48:42 -0600 Subject: 2012-09-28 Andreas Schwab [BZ #6530] * stdio-common/vfprintf.c (process_string_arg): Revert 2000-07-22 change. 2011-09-28 Jonathan Nieder * stdio-common/Makefile (tst-sprintf-ENV): Set environment for testcase. * stdio-common/tst-sprintf.c: Include (main): Test sprintf's handling of incomplete multibyte characters. --- stdio-common/tst-sprintf.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'stdio-common/tst-sprintf.c') diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c index c04fef18f4..c4e911fe94 100644 --- a/stdio-common/tst-sprintf.c +++ b/stdio-common/tst-sprintf.c @@ -1,5 +1,6 @@ #include #include +#include #include @@ -58,5 +59,17 @@ main (void) result = 1; } + if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) + { + puts ("cannot set locale"); + result = 1; + } + else if (sprintf (buf, "%.8s\n", "Foo: \277") != 7 + || strcmp (buf, "Foo: \277\n") != 0) + { + printf ("sprintf (buf, \"%%.8s\\n\", \"Foo: \\277\") produced '%s' output\n", buf); + result = 1; + } + return result; } -- cgit v1.2.3-70-g09d2