xref: /openbsd-src/gnu/usr.bin/texinfo/intl/gettext.c (revision a1acfa9b69ad64eb720639240c8438f11107dc85)
11cc83814Sespie /* Implementation of gettext(3) function.
2*a1acfa9bSespie    Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc.
3840175f0Skstailey 
43fb98d4aSespie    This program is free software; you can redistribute it and/or modify it
53fb98d4aSespie    under the terms of the GNU Library General Public License as published
63fb98d4aSespie    by the Free Software Foundation; either version 2, or (at your option)
7840175f0Skstailey    any later version.
8840175f0Skstailey 
9840175f0Skstailey    This program is distributed in the hope that it will be useful,
10840175f0Skstailey    but WITHOUT ANY WARRANTY; without even the implied warranty of
113fb98d4aSespie    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
123fb98d4aSespie    Library General Public License for more details.
13840175f0Skstailey 
143fb98d4aSespie    You should have received a copy of the GNU Library General Public
153fb98d4aSespie    License along with this program; if not, write to the Free Software
163fb98d4aSespie    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
173fb98d4aSespie    USA.  */
18840175f0Skstailey 
19840175f0Skstailey #ifdef HAVE_CONFIG_H
20840175f0Skstailey # include <config.h>
21840175f0Skstailey #endif
22840175f0Skstailey 
23840175f0Skstailey #ifdef _LIBC
24840175f0Skstailey # define __need_NULL
25840175f0Skstailey # include <stddef.h>
26840175f0Skstailey #else
27840175f0Skstailey # include <stdlib.h>		/* Just for NULL.  */
28840175f0Skstailey #endif
29840175f0Skstailey 
303fb98d4aSespie #include "gettextP.h"
31840175f0Skstailey #ifdef _LIBC
32840175f0Skstailey # include <libintl.h>
33840175f0Skstailey #else
343fb98d4aSespie # include "libgnuintl.h"
35840175f0Skstailey #endif
36840175f0Skstailey 
37840175f0Skstailey /* @@ end of prolog @@ */
38840175f0Skstailey 
39840175f0Skstailey /* Names for the libintl functions are a problem.  They must not clash
40840175f0Skstailey    with existing names and they should follow ANSI C.  But this source
41840175f0Skstailey    code is also used in GNU C Library where the names have a __
42840175f0Skstailey    prefix.  So we have to make a difference here.  */
43840175f0Skstailey #ifdef _LIBC
44840175f0Skstailey # define GETTEXT __gettext
45*a1acfa9bSespie # define DCGETTEXT INTUSE(__dcgettext)
46840175f0Skstailey #else
47*a1acfa9bSespie # define GETTEXT libintl_gettext
48*a1acfa9bSespie # define DCGETTEXT libintl_dcgettext
49840175f0Skstailey #endif
50840175f0Skstailey 
51840175f0Skstailey /* Look up MSGID in the current default message catalog for the current
52840175f0Skstailey    LC_MESSAGES locale.  If not found, returns MSGID itself (the default
53840175f0Skstailey    text).  */
54840175f0Skstailey char *
GETTEXT(const char * msgid)55*a1acfa9bSespie GETTEXT (const char *msgid)
56840175f0Skstailey {
573fb98d4aSespie   return DCGETTEXT (NULL, msgid, LC_MESSAGES);
58840175f0Skstailey }
59840175f0Skstailey 
60840175f0Skstailey #ifdef _LIBC
61840175f0Skstailey /* Alias for function name in GNU C Library.  */
62840175f0Skstailey weak_alias (__gettext, gettext);
63840175f0Skstailey #endif
64