1 | /* Test case for setlocale vs uselocale (LC_GLOBAL_LOCALE) bug. */ |
---|---|
2 | |
3 | #define _GNU_SOURCE 1 |
4 | #include <locale.h> |
5 | #include <stdio.h> |
6 | #include <ctype.h> |
7 | |
8 | static int |
9 | do_test (void) |
10 | { |
11 | locale_t loc_new, loc_old; |
12 | |
13 | int first = !!isalpha(0xE4); |
14 | |
15 | setlocale (LC_ALL, "de_DE"); |
16 | |
17 | int global_de = !!isalpha(0xE4); |
18 | |
19 | loc_new = newlocale (category_mask: 1 << LC_ALL, locale: "C", base: 0); |
20 | loc_old = uselocale (dataset: loc_new); |
21 | |
22 | int used_c = !!isalpha(0xE4); |
23 | |
24 | uselocale (dataset: loc_old); |
25 | |
26 | int used_global = !!isalpha(0xE4); |
27 | |
28 | printf (format: "started %d, after setlocale %d\n", first, global_de); |
29 | printf (format: "after uselocale %d, after LC_GLOBAL_LOCALE %d\n", |
30 | used_c, used_global); |
31 | |
32 | freelocale (dataset: loc_new); |
33 | return !(used_c == first && used_global == global_de); |
34 | } |
35 | |
36 | |
37 | #define TEST_FUNCTION do_test () |
38 | #include "test-skeleton.c" |
39 |