posix: Fix getpwnam_r usage (BZ #1062)
[glibc.git] / localedata / bug-usesetlocale.c
blob5f4a2d1a96a46e8dda2d00f90205406d3e989ec0
1 /* Test case for setlocale vs uselocale (LC_GLOBAL_LOCALE) bug. */
3 #define _GNU_SOURCE 1
4 #include <locale.h>
5 #include <stdio.h>
6 #include <ctype.h>
8 static int
9 do_test (void)
11 locale_t loc_new, loc_old;
13 int first = !!isalpha(0xE4);
15 setlocale (LC_ALL, "de_DE");
17 int global_de = !!isalpha(0xE4);
19 loc_new = newlocale (1 << LC_ALL, "C", 0);
20 loc_old = uselocale (loc_new);
22 int used_c = !!isalpha(0xE4);
24 uselocale (loc_old);
26 int used_global = !!isalpha(0xE4);
28 printf ("started %d, after setlocale %d\n", first, global_de);
29 printf ("after uselocale %d, after LC_GLOBAL_LOCALE %d\n",
30 used_c, used_global);
32 freelocale (loc_new);
33 return !(used_c == first && used_global == global_de);
37 #define TEST_FUNCTION do_test ()
38 #include "test-skeleton.c"