File: test-gencat.c

package info (click to toggle)
glibc 2.19-15
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 203,464 kB
  • sloc: ansic: 969,581; asm: 241,207; sh: 10,063; makefile: 8,472; cpp: 3,595; perl: 2,077; pascal: 1,839; awk: 1,704; yacc: 317; sed: 73
file content (31 lines) | stat: -rw-r--r-- 775 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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"));
  printf ("%s\n", catgets(catalog, 1, 6, "sample 6"));
  printf ("%s\n", catgets(catalog, 1, 7, "sample 7"));
  catclose (catalog);

  return 0;
}