diff options
Diffstat (limited to 'stdio-common/tst-sprintf.c')
-rw-r--r-- | stdio-common/tst-sprintf.c | 13 |
1 files changed, 13 insertions, 0 deletions
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 <stdio.h> #include <stdlib.h> +#include <locale.h> #include <string.h> @@ -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; } |