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