tst-setlocale.c 578 B

12345678910111213141516171819202122232425
  1. /* Test case by Jakub Jelinek <jakub@redhat.com>. */
  2. #include <locale.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. int
  6. main (void)
  7. {
  8. char q[30];
  9. char *s;
  10. setlocale (LC_ALL, "");
  11. printf ("after setlocale (LC_ALL, \"\"): %s\n", setlocale(LC_NUMERIC, NULL));
  12. strcpy (q, "de_DE.UTF-8");
  13. setlocale (LC_NUMERIC, q);
  14. printf ("after setlocale (LC_NUMERIC, \"%s\"): %s\n",
  15. q, setlocale(LC_NUMERIC, NULL));
  16. strcpy (q, "de_DE.ISO-8859-1");
  17. s = setlocale (LC_NUMERIC, NULL);
  18. printf ("after overwriting string: %s\n", s);
  19. return strcmp (s, "de_DE.UTF-8") != 0;
  20. }