Back to index

glibc  2.9
test-gencat.c
Go to the documentation of this file.
00001 #include <locale.h>
00002 #include <nl_types.h>
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 
00006 int
00007 main (void)
00008 {
00009   nl_catd catalog;
00010   setlocale (LC_ALL, "");
00011 
00012   printf ("LC_MESSAGES = %s\n", setlocale (LC_MESSAGES, NULL));
00013 
00014   catalog = catopen ("sample", NL_CAT_LOCALE);
00015   if (catalog == (nl_catd) -1)
00016     {
00017       printf ("no catalog: %m\n");
00018       exit (1);
00019     }
00020 
00021   printf ("%s\n", catgets(catalog, 1, 1, "sample 1"));
00022   printf ("%s\n", catgets(catalog, 1, 2, "sample 2"));
00023   printf ("%s\n", catgets(catalog, 1, 3, "sample 3"));
00024   printf ("%s\n", catgets(catalog, 1, 4, "sample 4"));
00025   printf ("%s\n", catgets(catalog, 1, 5, "sample 5"));
00026   printf ("%s\n", catgets(catalog, 1, 6, "sample 6"));
00027   printf ("%s\n", catgets(catalog, 1, 7, "sample 7"));
00028   catclose (catalog);
00029 
00030   return 0;
00031 }