1 /* Test program, used by the gettext-4 test.
2 Copyright (C) 2001, 2005-2006 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Contributed to the GNU C Library by
18 Bruno Haible <haible@clisp.cons.org>, 2001. */
30 /* Make sure we use the included libintl, not the system's one. */
32 #include "libgnuintl.h"
35 main (int argc, char *argv[])
40 /* Clean up environment. */
41 unsetenv ("LANGUAGE");
43 unsetenv ("LC_MESSAGES");
44 unsetenv ("LC_CTYPE");
46 unsetenv ("OUTPUT_CHARSET");
48 xsetenv ("LC_ALL", argv[1], 1);
49 setlocale (LC_ALL, "");
50 textdomain ("codeset");
51 bindtextdomain ("codeset", ".");
53 /* Here we expect output in ISO-8859-1.
54 Except on Darwin 7 or newer and on BeOS, for which locale_charset ()
55 always returns "UTF-8" (see config.charset). */
56 #if !((defined __APPLE__ && defined __MACH__) || defined __BEOS__)
57 s = gettext ("cheese");
58 if (strcmp (s, "K\344se"))
60 fprintf (stderr, "call 1 returned: %s\n", s);
65 bind_textdomain_codeset ("codeset", "UTF-8");
67 /* Here we expect output in UTF-8. */
68 s = gettext ("cheese");
69 if (strcmp (s, "K\303\244se"))
71 fprintf (stderr, "call 2 returned: %s\n", s);
75 bind_textdomain_codeset ("codeset", "ISO-8859-1");
77 /* Here we expect output in ISO-8859-1. */
78 s = gettext ("cheese");
79 if (strcmp (s, "K\344se"))
81 fprintf (stderr, "call 3 returned: %s\n", s);