1 // commit: 63f4b9f18f3674124d8bcb119739fec85e6da005 2 // uselocale(0) should not change the current locale 3 #include <locale.h> 4 #include "test.h" 5 main(void)6int main(void) 7 { 8 locale_t c = newlocale(LC_ALL_MASK, "C", 0); 9 10 if (!c) { 11 t_error("newlocale failed\n"); 12 return t_status; 13 } 14 15 if (!uselocale(c)) 16 t_error("uselocale(c) failed\n"); 17 18 locale_t l1 = uselocale(0); 19 if (l1 != c) 20 t_error("uselocale failed to set locale: " 21 "%p != %p\n", (void*)l1, (void*)c); 22 23 locale_t l2 = uselocale(0); 24 if (l2 != l1) 25 t_error("uselocale(0) changed locale: " 26 "%p != %p\n", (void*)l2, (void*)l1); 27 28 return t_status; 29 } 30