diff options
author | Roland McGrath <roland@gnu.org> | 2002-11-21 03:41:31 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-11-21 03:41:31 +0000 |
commit | 5d0bbaaf3a253601974ec9bc30f49fc4452d12ed (patch) | |
tree | 628c2cfc45c98444356af3891817839f87e737e2 /intl | |
parent | 9a5b9056e0b3db14d5f15c10d9c4114568c5d65b (diff) | |
download | glibc-5d0bbaaf3a253601974ec9bc30f49fc4452d12ed.tar glibc-5d0bbaaf3a253601974ec9bc30f49fc4452d12ed.tar.gz glibc-5d0bbaaf3a253601974ec9bc30f49fc4452d12ed.tar.bz2 glibc-5d0bbaaf3a253601974ec9bc30f49fc4452d12ed.zip |
* scripts/abilist.awk: Grok function descriptor symbols.
* intl/tst-gettext.c (main): Check return values from setlocale.
Add necessary unsetenv's to make LANG=existing-locale check work.
* intl/tst-gettext.sh: Use mkdir -p. Copy test files unconditionally,
so aborted prior runs don't confuse things.
* locale/localeinfo.h (struct locale_data: union locale_data_value):
Use uintptr_t instead of unsigned int for `word' member.
(_NL_CURRENT_WORD): Cast to uint32_t.
* posix/bug-regex5.c (main): Use union to extract _NL_COLLATE_NRULES
value.
Diffstat (limited to 'intl')
-rw-r--r-- | intl/tst-gettext.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/intl/tst-gettext.c b/intl/tst-gettext.c index 55b8310dfa..8a768e03c5 100644 --- a/intl/tst-gettext.c +++ b/intl/tst-gettext.c @@ -24,6 +24,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <error.h> +#include <errno.h> const struct @@ -52,6 +54,15 @@ static int positive_dcgettext_test (const char *domain, int category); static int negative_dcgettext_test (const char *domain, int category); +#define check_setlocale(cat, name) do { \ + if (setlocale (cat, name) == NULL) \ + { \ + printf ("%s:%u: setlocale (%s, \"%s\"): %m\n", \ + __FILE__, __LINE__, #cat, name); \ + result = 1; \ + } \ + } while (0) + int main (int argc, char *argv[]) { @@ -76,8 +87,8 @@ main (int argc, char *argv[]) setenv ("LC_MESSAGES", "non-existing-locale", 1); setenv ("LC_CTYPE", "non-existing-locale", 1); setenv ("LANG", "non-existing-locale", 1); - setlocale (LC_CTYPE, "de_DE.ISO-8859-1"); - setlocale (LC_MESSAGES, "de_DE.ISO-8859-1"); + check_setlocale (LC_CTYPE, "de_DE.ISO-8859-1"); + check_setlocale (LC_MESSAGES, "de_DE.ISO-8859-1"); unsetenv ("OUTPUT_CHARSET"); /* This is the name of the existing domain with a catalog for the LC_MESSAGES category. */ @@ -108,7 +119,7 @@ main (int argc, char *argv[]) /* Now the same tests with LC_ALL deciding. */ unsetenv ("LANGUAGE"); setenv ("LC_ALL", "existing-locale", 1); - setlocale (LC_ALL, ""); + check_setlocale (LC_ALL, ""); puts ("test `gettext' with LC_ALL set"); /* This is the name of the existing domain with a catalog for the LC_MESSAGES category. */ @@ -138,11 +149,17 @@ main (int argc, char *argv[]) /* Now the same tests with LC_MESSAGES deciding. */ unsetenv ("LC_ALL"); setenv ("LC_MESSAGES", "existing-locale", 1); - setlocale (LC_MESSAGES, ""); + check_setlocale (LC_MESSAGES, ""); setenv ("LC_TIME", "existing-locale", 1); - setlocale (LC_TIME, ""); + check_setlocale (LC_TIME, ""); setenv ("LC_NUMERIC", "non-existing-locale", 1); - setlocale (LC_NUMERIC, ""); + char *what = setlocale (LC_NUMERIC, ""); + if (what != NULL) + { + printf ("setlocale succeeded (%s), expected failure\n", what); + result = 1; + } + puts ("test `gettext' with LC_ALL set"); /* This is the name of the existing domain with a catalog for the LC_MESSAGES category. */ @@ -191,8 +208,11 @@ main (int argc, char *argv[]) /* Now the same tests with LANG deciding. */ unsetenv ("LC_MESSAGES"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_TIME"); + unsetenv ("LC_NUMERIC"); setenv ("LANG", "existing-locale", 1); - setlocale (LC_ALL, ""); + check_setlocale (LC_ALL, ""); /* This is the name of the existing domain with a catalog for the LC_MESSAGES category. */ textdomain ("existing-domain"); @@ -219,7 +239,7 @@ main (int argc, char *argv[]) result = 1; } - setlocale (LC_ALL, "C"); + check_setlocale (LC_ALL, "C"); return result; } |