mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 00:31:08 +00:00
ca130fe465
* catgets/open_catalog.c: Rewrite code to assume that the function is called at catopen time and not delayed in catgets. * catgets/catgets.c (catopen): Call __open_catalog and fail if that function failed. (catgets): Remove code for delayed opening of catalog. * catgets/catgetsinfo.h: Remove now unnecessary information from struct catalog_info. Change __open_catalog prototype. * catgets/gencat.c: Adjust __open_catalog call. * catgets/test-gencat.c: Stop program if catopen failed.
30 lines
665 B
C
30 lines
665 B
C
#include <locale.h>
|
|
#include <nl_types.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
nl_catd catalog;
|
|
setlocale (LC_ALL, "");
|
|
|
|
printf ("LC_MESSAGES = %s\n", setlocale (LC_MESSAGES, NULL));
|
|
|
|
catalog = catopen ("sample", NL_CAT_LOCALE);
|
|
if (catalog == (nl_catd) -1)
|
|
{
|
|
printf ("no catalog: %m\n");
|
|
exit (1);
|
|
}
|
|
|
|
printf ("%s\n", catgets(catalog, 1, 1, "sample 1"));
|
|
printf ("%s\n", catgets(catalog, 1, 2, "sample 2"));
|
|
printf ("%s\n", catgets(catalog, 1, 3, "sample 3"));
|
|
printf ("%s\n", catgets(catalog, 1, 4, "sample 4"));
|
|
printf ("%s\n", catgets(catalog, 1, 5, "sample 5"));
|
|
catclose (catalog);
|
|
|
|
return 0;
|
|
}
|