16static int my_streq(
const char *va,
const char *vb) {
20 if ((NULL == a) || (NULL == b)) {
23 for (i=0; a[i] !=
'\0' && b[i] !=
'\0'; i++) {
31#if defined(CODESET_UTF_8)
32#define MY_CODESET "UTF-8"
33#elif defined(CODESET_LATIN1)
34#define MY_CODESET "iso-8859-1"
35#elif defined(CODESET_DEFAULT)
36#define MY_CODESET "default"
37#define bind_textdomain_codeset(domain,codeset) \
40#error Define one of the CODESET_* macros!
52 N_(
"High saturation"),
56 "Hohe S\303\244ttigung" },
65 N_(
"High saturation"),
69 "Alta saturaci\303\263n"
71 { NULL, NULL, NULL, NULL }
78 const char *newtextdomain =
textdomain(GETTEXT_PACKAGE);
80 const char *newcodeset = MY_CODESET;
90 "Old textdomain: %s\n"
91 "New textdomain: %s\n",
96 if (NULL != oldcodeset) {
98 "Old codeset: \"%s\" (locale default)\n",
103 "Old codeset: \"%s\"\n",
109 "Wanted codeset: %s\n"
110 "Real codeset: %s\n",
126#if defined(CODESET_UTF_8)
128#elif defined(CODESET_LATIN_1)
141 const char *localeenv = getenv(
"LOCALEDIR");
142 const char *localedir = (localeenv!=NULL)?localeenv:LOCALEDIR;
143 const char *msgcatdir =
bindtextdomain(GETTEXT_PACKAGE, localedir);
146 const char *oldlocale = setlocale(LC_ALL, NULL);
147 const char *newlocale = setlocale(LC_ALL,
"");
149 if (localeenv != NULL) {
150 printf(
"Msg catalog dir: %s (from environment variable LOCALEDIR\n",
153 printf(
"Msg catalog dir: %s\n", msgcatdir);
156 if (newlocale == NULL) {
157 printf(
"Locale not available: \"%s\"\n", newlocale);
158 printf(
"Aborting without error.\n");
171 const int localelen = strlen(
testcases[i].locale);
172 if (strncmp(newlocale,
testcases[i].locale, localelen) == 0) {
177 printf(
"No test case found for locale: %s\n", newlocale);
182int main(
int argc,
char *argv[])
185 if ((argc == 2) && (strcmp(
"--list", argv[1]) == 0)) {
193 fprintf(stderr,
"Illegal command line. Aborting.\n");
194 fprintf(stderr,
"argc: %03d\n", argc);
195 for (i=0; i<argc; i++) {
196 fprintf(stderr,
"%03d \"%s\"\n", i, argv[i]);
202 printf(
"Test result: %s\n", (ret)?
"success":
"failure");
#define textdomain(String)
#define bind_textdomain_codeset(Domain, Codeset)
#define bindtextdomain(Domain, Directory)
const TestCase testcases[]
static int my_streq(const char *va, const char *vb)
static int check(const int i)