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