Get rid of __LT_SPINLOCK_INIT
[glibc.git] / iconvdata / bug-iconv6.c
blobb364f4c161035800e40cd27d417103a782bd28c6
1 #include <string.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <errno.h>
5 #include <iconv.h>
6 #include <locale.h>
8 static const char testbuf[] = {
9 0xEF, 0xBE, 0x9F, 0xD0, 0xB4, 0xEF, 0xBE, 0x9F, 0x29, 0xEF, 0xBE, 0x8E,
10 0xEF, 0xBE, 0x9F, 0xEF, 0xBD, 0xB6, 0xEF, 0xBD, 0xB0, 0xEF, 0xBE, 0x9D
13 static int
14 do_test (void)
16 setlocale (LC_ALL, "de_DE.UTF-8");
17 iconv_t ic = iconv_open ("ISO-2022-JP//TRANSLIT", "UTF-8");
18 if (ic == (iconv_t) -1)
20 puts ("iconv_open failed");
21 return 1;
23 size_t outremain = sizeof testbuf;
24 char outbuf[outremain];
25 char *inp = (char *) testbuf;
26 char *outp = outbuf;
27 size_t inremain = sizeof testbuf;
29 int ret = iconv (ic, &inp, &inremain, &outp, &outremain);
31 int result = 0;
32 if (ret == (size_t) -1)
34 if (errno == E2BIG)
35 puts ("buffer too small reported. OK");
36 else
38 printf ("iconv failed with %d (%m)\n", errno);
39 result = 0;
42 else
44 printf ("iconv returned %d\n", ret);
45 result = 1;
48 return result;
51 #define TEST_FUNCTION do_test ()
52 #include "../test-skeleton.c"