12 static int my_streq(
const char *va,
const char *vb) {
16 if ((NULL == a) || (NULL == b)) {
19 for (i=0; a[i] !=
'\0' && b[i] !=
'\0'; i++) {
27 #if defined(CODESET_UTF_8)
28 #define MY_CODESET "UTF-8"
29 #elif defined(CODESET_LATIN1)
30 #define MY_CODESET "iso-8859-1"
31 #elif defined(CODESET_DEFAULT)
32 #define MY_CODESET "default"
33 #define bind_textdomain_codeset(domain,codeset) \
36 #error Define one of the CODESET_* macros!
48 N_(
"High saturation"),
52 "Hohe S\303\244ttigung" },
61 N_(
"High saturation"),
65 "Alta saturaci\303\263n"
67 { NULL, NULL, NULL, NULL }
74 const char *newtextdomain =
textdomain(GETTEXT_PACKAGE);
76 const char *newcodeset = MY_CODESET;
86 "Old textdomain: %s\n"
87 "New textdomain: %s\n",
92 if (NULL != oldcodeset) {
94 "Old codeset: \"%s\" (locale default)\n",
99 "Old codeset: \"%s\"\n",
105 "Wanted codeset: %s\n"
106 "Real codeset: %s\n",
122 #if defined(CODESET_UTF_8)
124 #elif defined(CODESET_LATIN_1)
137 const char *localeenv = getenv(
"LOCALEDIR");
138 const char *localedir = (localeenv!=NULL)?localeenv:LOCALEDIR;
139 const char *msgcatdir =
bindtextdomain(GETTEXT_PACKAGE, localedir);
142 const char *oldlocale = setlocale(LC_ALL, NULL);
143 const char *newlocale = setlocale(LC_ALL,
"");
145 if (localeenv != NULL) {
146 printf(
"Msg catalog dir: %s (from environment variable LOCALEDIR\n",
149 printf(
"Msg catalog dir: %s\n", msgcatdir);
152 if (newlocale == NULL) {
153 printf(
"Locale not available: \"%s\"\n", newlocale);
154 printf(
"Aborting without error.\n");
167 const int localelen = strlen(
testcases[i].locale);
168 if (strncmp(newlocale,
testcases[i].locale, localelen) == 0) {
173 printf(
"No test case found for locale: %s\n", newlocale);
178 int main(
int argc,
char *argv[])
181 if ((argc == 2) && (strcmp(
"--list", argv[1]) == 0)) {
189 fprintf(stderr,
"Illegal command line. Aborting.\n");
190 fprintf(stderr,
"argc: %03d\n", argc);
191 for (i=0; i<argc; i++) {
192 fprintf(stderr,
"%03d \"%s\"\n", i, argv[i]);
198 printf(
"Test result: %s\n", (ret)?
"success":
"failure");
#define textdomain(String)
#define bind_textdomain_codeset(Domain, Codeset)
#define bindtextdomain(Domain, Directory)
int main(int argc, char *argv[])
const TestCase testcases[]
static int my_streq(const char *va, const char *vb)
static int check(const int i)