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 2, or (at your option) 7 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, write to the Free Software Foundation, 16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 17 18 /* Written by Bruno Haible <haible@clisp.cons.org>, 2005. */ 19 20 #ifdef HAVE_CONFIG_H 21 # include <config.h> 22 #endif 23 24 #include <locale.h> 25 #include <stdlib.h> 26 #include <stdio.h> 27 #include <string.h> 28 #include "setenv.h" 29 30 /* Make sure we use the included libintl, not the system's one. */ 31 #undef _LIBINTL_H 32 #include "libgnuintl.h" 33 34 int 35 main (void) 36 { 37 char *s; 38 int result = 0; 39 40 unsetenv ("LANGUAGE"); 41 unsetenv ("OUTPUT_CHARSET"); 42 textdomain ("codeset"); 43 bindtextdomain ("codeset", "."); 44 45 setlocale (LC_ALL, "de_DE.ISO-8859-1"); 46 47 /* Here we expect output in ISO-8859-1. */ 48 s = gettext ("cheese"); 49 if (strcmp (s, "K\344se")) 50 { 51 fprintf (stderr, "call 1 returned: %s\n", s); 52 result = 1; 53 } 54 55 setlocale (LC_ALL, "de_DE.UTF-8"); 56 57 /* Here we expect output in UTF-8. */ 58 s = gettext ("cheese"); 59 if (strcmp (s, "K\303\244se")) 60 { 61 fprintf (stderr, "call 2 returned: %s\n", s); 62 result = 1; 63 } 64 65 return result; 66 } 67