]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/testlang.c
2 * "$Id: testlang.c 6649 2007-07-11 21:46:42Z mike $"
4 * Localization test program for the Common UNIX Printing System (CUPS).
6 * Copyright 2007 by Apple Inc.
7 * Copyright 1997-2006 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
15 * This file is subject to the Apple OS-Developed Software exception.
19 * main() - Load the specified language and show the strings for yes and no.
23 * Include necessary headers...
32 * 'main()' - Load the specified language and show the strings for yes and no.
35 int /* O - Exit status */
36 main(int argc
, /* I - Number of command-line arguments */
37 char *argv
[]) /* I - Command-line arguments */
39 int i
; /* Looping var */
40 int errors
= 0; /* Number of errors */
41 cups_lang_t
*language
; /* Message catalog */
42 cups_lang_t
*language2
; /* Message catalog */
43 struct lconv
*loc
; /* Locale data */
44 char buffer
[1024]; /* String buffer */
45 double number
; /* Number */
46 static const char * const tests
[] = /* Test strings */
59 language
= cupsLangDefault();
60 language2
= cupsLangDefault();
64 language
= cupsLangGet(argv
[1]);
65 language2
= cupsLangGet(argv
[1]);
68 if (language
!= language2
)
72 puts("**** ERROR: Language cache did not work! ****");
73 puts("First result from cupsLangGet:");
76 printf("Language = \"%s\"\n", language
->language
);
77 printf("Encoding = \"%s\"\n", _cupsEncodingName(language
->encoding
));
78 printf("No = \"%s\"\n", _cupsLangString(language
, "No"));
79 printf("Yes = \"%s\"\n", _cupsLangString(language
, "Yes"));
81 if (language
!= language2
)
83 puts("Second result from cupsLangGet:");
85 printf("Language = \"%s\"\n", language2
->language
);
86 printf("Encoding = \"%s\"\n", _cupsEncodingName(language2
->encoding
));
87 printf("No = \"%s\"\n", _cupsLangString(language2
, "No"));
88 printf("Yes = \"%s\"\n", _cupsLangString(language2
, "Yes"));
93 for (i
= 0; i
< (int)(sizeof(tests
) / sizeof(tests
[0])); i
++)
95 number
= _cupsStrScand(tests
[i
], NULL
, loc
);
97 printf("_cupsStrScand(\"%s\") number=%f\n", tests
[i
], number
);
99 _cupsStrFormatd(buffer
, buffer
+ sizeof(buffer
), number
, loc
);
101 printf("_cupsStrFormatd(%f) buffer=\"%s\"\n", number
, buffer
);
103 if (strcmp(buffer
, tests
[i
]))
106 puts("**** ERROR: Bad formatted number! ****");
115 * End of "$Id: testlang.c 6649 2007-07-11 21:46:42Z mike $".