xref: /netbsd-src/external/gpl2/gettext/dist/gettext-runtime/intl/gettext.c (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos /* Implementation of gettext(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 /* @@ end of prolog @@ */
38*946379e7Schristos 
39*946379e7Schristos /* Names for the libintl functions are a problem.  They must not clash
40*946379e7Schristos    with existing names and they should follow ANSI C.  But this source
41*946379e7Schristos    code is also used in GNU C Library where the names have a __
42*946379e7Schristos    prefix.  So we have to make a difference here.  */
43*946379e7Schristos #ifdef _LIBC
44*946379e7Schristos # define GETTEXT __gettext
45*946379e7Schristos # define DCGETTEXT INTUSE(__dcgettext)
46*946379e7Schristos #else
47*946379e7Schristos # define GETTEXT libintl_gettext
48*946379e7Schristos # define DCGETTEXT libintl_dcgettext
49*946379e7Schristos #endif
50*946379e7Schristos 
51*946379e7Schristos /* Look up MSGID in the current default message catalog for the current
52*946379e7Schristos    LC_MESSAGES locale.  If not found, returns MSGID itself (the default
53*946379e7Schristos    text).  */
54*946379e7Schristos char *
GETTEXT(const char * msgid)55*946379e7Schristos GETTEXT (const char *msgid)
56*946379e7Schristos {
57*946379e7Schristos   return DCGETTEXT (NULL, msgid, LC_MESSAGES);
58*946379e7Schristos }
59*946379e7Schristos 
60*946379e7Schristos #ifdef _LIBC
61*946379e7Schristos /* Alias for function name in GNU C Library.  */
62*946379e7Schristos weak_alias (__gettext, gettext);
63*946379e7Schristos #endif
64