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