No empty .Rs/.Re
[netbsd-mini2440.git] / regress / lib / libc / citrus / mbtowc / mbtowc_test.c
blob8fa9a4f13710c72baa6923bb865b81a383087ae6
1 /* From: Miloslav Trmac <mitr@volny.cz> */
2 #include <langinfo.h>
3 #include <limits.h>
4 #include <locale.h>
5 #include <stdio.h>
6 #include <stdlib.h>
8 int
9 main(void)
11 wchar_t wc;
12 char back[MB_LEN_MAX];
13 int ret;
14 size_t i;
16 setlocale(LC_ALL, "");
17 printf("Charset: %s\n", nl_langinfo(CODESET));
18 ret = mbtowc(&wc, "\xe4", 1);
19 printf("mbtowc(): %d\n", ret);
20 if(ret > 0) {
21 printf("Result: 0x%08lX\n",(unsigned long)wc);
22 ret = wctomb(back, wc);
23 printf("wctomb(): %d\n", ret);
24 for(i = 0; ret > 0 && i <(size_t)ret; i++)
25 printf("%02X ",(unsigned char)back[i]);
26 putchar('\n');
27 return EXIT_SUCCESS;
28 } else
29 return EXIT_FAILURE;