1 /* Test program, used by the format-c-3 test.
2 Copyright (C) 2002, 2009 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/>. */
25 #ifdef HAVE_INTTYPES_H
26 # include <inttypes.h>
30 /* Make sure we use the included libintl, not the system's one. */
32 #include "libgnuintl.h"
34 /* Disable the override of setlocale that libgnuintl.h activates on MacOS X
35 and Windows. This test relies on the fake setlocale function in
39 #define _(string) gettext (string)
41 /* Fallback definition. */
42 #if !defined PRId8 || PRI_MACROS_BROKEN
48 main (int argc, char *argv[])
56 xsetenv ("LC_ALL", argv[1], 1);
57 if (setlocale (LC_ALL, "") == NULL)
59 fprintf (stderr, "Couldn't set locale.\n");
64 bindtextdomain ("fc3", "fc3-dir");
66 s = gettext ("father of %"PRId8" children");
67 c1 = "Vater von %"; c2 = " Kindern";
69 if (!(strlen (s) > strlen (c1) + strlen (c2)
70 && memcmp (s, c1, strlen (c1)) == 0
71 && memcmp (s + strlen (s) - strlen (c2), c2, strlen (c2)) == 0))
73 fprintf (stderr, "String not translated.\n");
76 if (strchr (s, '<') != NULL || strchr (s, '>') != NULL)
78 fprintf (stderr, "Translation contains <...> markers.\n");
82 if (strcmp (buf, "Vater von 5 Kindern") != 0)
84 fprintf (stderr, "printf of translation wrong.\n");