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