xref: /netbsd/external/gpl3/gcc/dist/intl/ngettext.c (revision c3d31fe1)
1*c3d31fe1Smrg /* Implementation of ngettext(3) function.
2*c3d31fe1Smrg    Copyright (C) 1995, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
3*c3d31fe1Smrg 
4*c3d31fe1Smrg    This program is free software; you can redistribute it and/or modify it
5*c3d31fe1Smrg    under the terms of the GNU Library General Public License as published
6*c3d31fe1Smrg    by the Free Software Foundation; either version 2, or (at your option)
7*c3d31fe1Smrg    any later version.
8*c3d31fe1Smrg 
9*c3d31fe1Smrg    This program is distributed in the hope that it will be useful,
10*c3d31fe1Smrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*c3d31fe1Smrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*c3d31fe1Smrg    Library General Public License for more details.
13*c3d31fe1Smrg 
14*c3d31fe1Smrg    You should have received a copy of the GNU Library General Public
15*c3d31fe1Smrg    License along with this program; if not, write to the Free Software
16*c3d31fe1Smrg    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
17*c3d31fe1Smrg    USA.  */
18*c3d31fe1Smrg 
19*c3d31fe1Smrg #ifdef HAVE_CONFIG_H
20*c3d31fe1Smrg # include <config.h>
21*c3d31fe1Smrg #endif
22*c3d31fe1Smrg 
23*c3d31fe1Smrg #ifdef _LIBC
24*c3d31fe1Smrg # define __need_NULL
25*c3d31fe1Smrg # include <stddef.h>
26*c3d31fe1Smrg #else
27*c3d31fe1Smrg # include <stdlib.h>		/* Just for NULL.  */
28*c3d31fe1Smrg #endif
29*c3d31fe1Smrg 
30*c3d31fe1Smrg #include "gettextP.h"
31*c3d31fe1Smrg #ifdef _LIBC
32*c3d31fe1Smrg # include <libintl.h>
33*c3d31fe1Smrg #else
34*c3d31fe1Smrg # include "libgnuintl.h"
35*c3d31fe1Smrg #endif
36*c3d31fe1Smrg 
37*c3d31fe1Smrg #include <locale.h>
38*c3d31fe1Smrg 
39*c3d31fe1Smrg /* @@ end of prolog @@ */
40*c3d31fe1Smrg 
41*c3d31fe1Smrg /* Names for the libintl functions are a problem.  They must not clash
42*c3d31fe1Smrg    with existing names and they should follow ANSI C.  But this source
43*c3d31fe1Smrg    code is also used in GNU C Library where the names have a __
44*c3d31fe1Smrg    prefix.  So we have to make a difference here.  */
45*c3d31fe1Smrg #ifdef _LIBC
46*c3d31fe1Smrg # define NGETTEXT __ngettext
47*c3d31fe1Smrg # define DCNGETTEXT __dcngettext
48*c3d31fe1Smrg #else
49*c3d31fe1Smrg # define NGETTEXT libintl_ngettext
50*c3d31fe1Smrg # define DCNGETTEXT libintl_dcngettext
51*c3d31fe1Smrg #endif
52*c3d31fe1Smrg 
53*c3d31fe1Smrg /* Look up MSGID in the current default message catalog for the current
54*c3d31fe1Smrg    LC_MESSAGES locale.  If not found, returns MSGID itself (the default
55*c3d31fe1Smrg    text).  */
56*c3d31fe1Smrg char *
NGETTEXT(msgid1,msgid2,n)57*c3d31fe1Smrg NGETTEXT (msgid1, msgid2, n)
58*c3d31fe1Smrg      const char *msgid1;
59*c3d31fe1Smrg      const char *msgid2;
60*c3d31fe1Smrg      unsigned long int n;
61*c3d31fe1Smrg {
62*c3d31fe1Smrg   return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
63*c3d31fe1Smrg }
64*c3d31fe1Smrg 
65*c3d31fe1Smrg #ifdef _LIBC
66*c3d31fe1Smrg /* Alias for function name in GNU C Library.  */
67*c3d31fe1Smrg weak_alias (__ngettext, ngettext);
68*c3d31fe1Smrg #endif
69