mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 06:20:06 +00:00
Test case for handling string passed to setlocale.
This commit is contained in:
parent
62e82a340f
commit
9a0fe6a812
25
localedata/tst-setlocale.c
Normal file
25
localedata/tst-setlocale.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* Test case by Jakub Jelinek <jakub@redhat.com>. */
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
char q[30];
|
||||
char *s;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
printf ("after setlocale (LC_ALL, \"\"): %s\n", setlocale(LC_NUMERIC, NULL));
|
||||
|
||||
strcpy (q, "de_DE.UTF-8");
|
||||
setlocale (LC_NUMERIC, q);
|
||||
printf ("after setlocale (LC_NUMERIC, \"%s\"): %s\n",
|
||||
q, setlocale(LC_NUMERIC, NULL));
|
||||
|
||||
strcpy (q, "de_DE.ISO-8859-1");
|
||||
s = setlocale (LC_NUMERIC, NULL);
|
||||
printf ("after overwriting string: %s\n", s);
|
||||
|
||||
return strcmp (s, "de_DE.UTF-8") != 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user