• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/gettext-0.17/gettext-tools/tests/
1/* Test program, used by the gettext-5 test.
2   Copyright (C) 2005 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>.  */
16
17/* Written by Bruno Haible <haible@clisp.cons.org>, 2005.  */
18
19#ifdef HAVE_CONFIG_H
20# include <config.h>
21#endif
22
23#include <locale.h>
24#include <stdlib.h>
25#include <stdio.h>
26#include <string.h>
27#include "setenv.h"
28
29/* Make sure we use the included libintl, not the system's one. */
30#undef _LIBINTL_H
31#include "libgnuintl.h"
32
33int
34main (void)
35{
36  char *s;
37  int result = 0;
38
39  unsetenv ("LANGUAGE");
40  unsetenv ("OUTPUT_CHARSET");
41  textdomain ("codeset");
42  bindtextdomain ("codeset", ".");
43
44  setlocale (LC_ALL, "de_DE.ISO-8859-1");
45
46  /* Here we expect output in ISO-8859-1.  */
47  s = gettext ("cheese");
48  if (strcmp (s, "K\344se"))
49    {
50      fprintf (stderr, "call 1 returned: %s\n", s);
51      result = 1;
52    }
53
54  setlocale (LC_ALL, "de_DE.UTF-8");
55
56  /* Here we expect output in UTF-8.  */
57  s = gettext ("cheese");
58  if (strcmp (s, "K\303\244se"))
59    {
60      fprintf (stderr, "call 2 returned: %s\n", s);
61      result = 1;
62    }
63
64  return result;
65}
66