Back to index

glibc  2.9
tst-setlocale.c
Go to the documentation of this file.
00001 /* Test case by Jakub Jelinek <jakub@redhat.com>.  */
00002 #include <locale.h>
00003 #include <stdio.h>
00004 #include <string.h>
00005 
00006 int
00007 main (void)
00008 {
00009   char q[30];
00010   char *s;
00011 
00012   setlocale (LC_ALL, "");
00013   printf ("after setlocale (LC_ALL, \"\"): %s\n", setlocale(LC_NUMERIC, NULL));
00014 
00015   strcpy (q, "de_DE.UTF-8");
00016   setlocale (LC_NUMERIC, q);
00017   printf ("after setlocale (LC_NUMERIC, \"%s\"): %s\n",
00018          q, setlocale(LC_NUMERIC, NULL));
00019 
00020   strcpy (q, "de_DE.ISO-8859-1");
00021   s = setlocale (LC_NUMERIC, NULL);
00022   printf ("after overwriting string: %s\n", s);
00023 
00024   return strcmp (s, "de_DE.UTF-8") != 0;
00025 }