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