lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Test case by Al Viro <aviro@redhat.com>. */ |
| 2 | #include <locale.h> |
| 3 | #include <wchar.h> |
| 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
| 6 | |
| 7 | /* MB_CUR_MAX multibyte ones (6 UTF+0080, in this case) */ |
| 8 | static const char string[] = "\ |
| 9 | \xc2\x80\xc2\x80\xc2\x80\xc2\x80\xc2\x80\xc2\x80"; |
| 10 | |
| 11 | int |
| 12 | main (void) |
| 13 | { |
| 14 | if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) |
| 15 | { |
| 16 | puts ("cannot set locale"); |
| 17 | exit (1); |
| 18 | } |
| 19 | |
| 20 | wchar_t s[7]; |
| 21 | int n = sscanf (string, "%l[\x80\xc2]", s); |
| 22 | if (n != 1) |
| 23 | { |
| 24 | printf ("return values %d != 1\n", n); |
| 25 | exit (1); |
| 26 | } |
| 27 | |
| 28 | return 0; |
| 29 | } |