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