linux: Use fchmodat2 on fchmod for flags different than 0 (BZ 26401)
[glibc.git] / stdlib / testmb.c
blob6ac4dfd21d2d33b89d6dd11dc4c0220bc4addabf
1 #include <stdio.h>
2 #include <stdlib.h>
4 int
5 main (int argc, char *argv[])
7 wchar_t w[10];
8 char c[10];
9 int i;
10 int lose = 0;
12 i = mbstowcs (w, "bar", 4);
13 if (!(i == 3 && w[1] == 'a'))
15 puts ("mbstowcs FAILED!");
16 lose = 1;
19 i = mbstowcs (NULL, "bar", 4);
20 if (!(i == 3 && w[1] == 'a'))
22 puts ("mbstowcs FAILED2!");
23 lose = 1;
26 mbstowcs (w, "blah", 5);
27 i = wcstombs (c, w, 10);
28 if (i != 4)
30 puts ("wcstombs FAILED!");
31 lose = 1;
34 if (mblen ("foobar", 7) != 1)
36 puts ("mblen 1 FAILED!");
37 lose = 1;
40 if (mblen ("", 1) != 0)
42 puts ("mblen 2 FAILED!");
43 lose = 1;
47 int r;
48 char c = 'x';
49 wchar_t wc;
50 char mbc[MB_CUR_MAX];
52 if ((r = mbtowc (&wc, &c, MB_CUR_MAX)) <= 0)
54 printf ("conversion to wide failed, result: %d\n", r);
55 lose = 1;
57 else
59 printf ("wide value: 0x%04lx\n", (unsigned long) wc);
60 mbc[0] = '\0';
61 if ((r = wctomb (mbc, wc)) <= 0)
63 printf ("conversion to multibyte failed, result: %d\n", r);
64 lose = 1;
70 puts (lose ? "Test FAILED!" : "Test succeeded.");
71 return lose;