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