Test case for handling string passed to setlocale.
authorUlrich Drepper <drepper@redhat.com>
Fri, 1 Dec 2000 00:15:38 +0000 (00:15 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 1 Dec 2000 00:15:38 +0000 (00:15 +0000)
localedata/tst-setlocale.c [new file with mode: 0644]

diff --git a/localedata/tst-setlocale.c b/localedata/tst-setlocale.c
new file mode 100644 (file)
index 0000000..1f8e68d
--- /dev/null
@@ -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;
+}