1 /* Copyright (C) 2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>,
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 /* Test bugzilla 13691 */
30 const char * in
= "A";
31 const char *inbuf
= in
;
32 size_t inlen
= strchr (in
, '\0') - inbuf
;
37 const char *locale
= "vi_VN.TCVN5712-1";
38 if (!setlocale (LC_ALL
, locale
))
40 printf ("Locale not available.\n");
44 memset (&ps
, '\0', sizeof (ps
));
45 memset (out
, '\0', sizeof (out
));
47 /* If the bug isn't fixed, it isn't going to return from mbsnrtowcs due to
49 size_t n
= mbsnrtowcs (out
, &inbuf
, inlen
, sizeof(out
) - 1, &ps
);
55 printf ("n = %zu, expected 1\n", n
);
61 for (i
= 0; i
< inlen
; i
++)
63 printf ("0x%X ", in
[i
]);
67 char * outb
= (char *) out
;
69 for (i
= 0; i
< sizeof (out
); i
++)
75 printf ("%X", outb
[i
]);
82 #define TEST_FUNCTION do_test ()
83 #include "../test-skeleton.c"