diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-12-01 00:15:38 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-12-01 00:15:38 +0000 |
commit | 9a0fe6a8124692b9b09489f64717af94d1ffac13 (patch) | |
tree | 13cd28196a76d71fa4a9f833c1718435aca581bc /localedata/tst-setlocale.c | |
parent | * sysdeps/mach/hurd/defs.c (init_stdio): Put this on __libc_subinit (diff) | |
download | glibc-9a0fe6a8124692b9b09489f64717af94d1ffac13.tar.gz glibc-9a0fe6a8124692b9b09489f64717af94d1ffac13.tar.bz2 glibc-9a0fe6a8124692b9b09489f64717af94d1ffac13.zip |
Test case for handling string passed to setlocale.
Diffstat (limited to 'localedata/tst-setlocale.c')
-rw-r--r-- | localedata/tst-setlocale.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/localedata/tst-setlocale.c b/localedata/tst-setlocale.c new file mode 100644 index 0000000000..1f8e68d887 --- /dev/null +++ b/localedata/tst-setlocale.c @@ -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; +} |