(openlog_internal): Use SOCK_CLOEXEC if possible.
[glibc/history.git] / localedata / tst-xlocale1.c
blob297c9ad7e1d7ddce7532593dc4db7e8bdfe44280
1 #include <locale.h>
2 #include <stdio.h>
3 #include <string.h>
6 static struct
8 const char *locale;
9 const char *str1;
10 const char *str2;
11 int result;
12 } tests[] =
14 { "C", "TRANSLIT", "translit", 0 },
15 { "de_DE.ISO-8859-1", "TRANSLIT", "translit", 0 },
16 { "de_DE.ISO-8859-1", "TRANSLIT", "trÄnslit", -1 },
17 { "de_DE.UTF-8", "TRANSLIT", "translit", 0 },
18 { "de_DE.ISO-8859-1", "ä", "Ä", 1 }
20 #define ntests (sizeof (tests) / sizeof (tests[0]))
23 int
24 main (void)
26 size_t cnt;
27 int result = 0;
28 locale_t loc = newlocale (1 << LC_ALL, "C", NULL);
30 for (cnt = 0; cnt < ntests; ++cnt)
32 int r;
34 if (setlocale (LC_ALL, tests[cnt].locale) == NULL)
36 printf ("cannot set locale \"%s\": %m\n", tests[cnt].locale);
37 result = 1;
38 continue;
41 printf ("\nstrcasecmp_l (\"%s\", \"%s\", loc)\n",
42 tests[cnt].str1, tests[cnt].str2);
44 r = strcasecmp_l (tests[cnt].str1, tests[cnt].str2, loc);
45 if (tests[cnt].result == 0)
47 if (r != 0)
49 printf ("\"%s\" and \"%s\" expected to be the same, result %d\n",
50 tests[cnt].str1, tests[cnt].str2, r);
51 result = 1;
54 else if (tests[cnt].result < 0)
56 if (r >= 0)
58 printf ("\"%s\" expected to be smaller than \"%s\", result %d\n",
59 tests[cnt].str1, tests[cnt].str2, r);
60 result = 1;
63 else
65 if (r <= 0)
67 printf ("\"%s\" expected to be larger than \"%s\", result %d\n",
68 tests[cnt].str1, tests[cnt].str2, r);
69 result = 1;
74 return result;