summaryrefslogtreecommitdiffstats
path: root/tests/plural-1-prg.c
blob: e7bc5013d645adb6b76602d2c2a51c16cec7f4f4 (plain)
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
32
/* Test program, used by the plural-1 test.  */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdlib.h>
#include <stdio.h>
#include <locale.h>

/* Make sure we use the included libintl, not the system's one. */
#define textdomain textdomain__
#define bindtextdomain bindtextdomain__
#define ngettext ngettext__
#undef _LIBINTL_H
#include "libgnuintl.h"

int main (argc, argv)
  int argc;
  char *argv[];
{
  int n = atoi (argv[1]);

  if (setlocale (LC_ALL, "") == NULL)
    return 1;

  textdomain ("cake");
  bindtextdomain ("cake", ".");
  printf (ngettext ("a piece of cake", "%d pieces of cake", n), n);
  printf ("\n");
  return 0;
}