xref: /openbsd-src/gnu/usr.bin/binutils-2.17/intl/dgettext.c (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* Implementation of the dgettext(3) function
2*3d8817e4Smiod    Copyright (C) 1995, 1996, 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 #if defined HAVE_LOCALE_H || defined _LIBC
23*3d8817e4Smiod # include <locale.h>
24*3d8817e4Smiod #endif
25*3d8817e4Smiod 
26*3d8817e4Smiod #ifdef _LIBC
27*3d8817e4Smiod # include <libintl.h>
28*3d8817e4Smiod #else
29*3d8817e4Smiod # include "libgettext.h"
30*3d8817e4Smiod #endif
31*3d8817e4Smiod 
32*3d8817e4Smiod /* @@ end of prolog @@ */
33*3d8817e4Smiod 
34*3d8817e4Smiod /* Names for the libintl functions are a problem.  They must not clash
35*3d8817e4Smiod    with existing names and they should follow ANSI C.  But this source
36*3d8817e4Smiod    code is also used in GNU C Library where the names have a __
37*3d8817e4Smiod    prefix.  So we have to make a difference here.  */
38*3d8817e4Smiod #ifdef _LIBC
39*3d8817e4Smiod # define DGETTEXT __dgettext
40*3d8817e4Smiod # define DCGETTEXT __dcgettext
41*3d8817e4Smiod #else
42*3d8817e4Smiod # define DGETTEXT dgettext__
43*3d8817e4Smiod # define DCGETTEXT dcgettext__
44*3d8817e4Smiod #endif
45*3d8817e4Smiod 
46*3d8817e4Smiod /* Look up MSGID in the DOMAINNAME message catalog of the current
47*3d8817e4Smiod    LC_MESSAGES locale.  */
48*3d8817e4Smiod char *
DGETTEXT(domainname,msgid)49*3d8817e4Smiod DGETTEXT (domainname, msgid)
50*3d8817e4Smiod      const char *domainname;
51*3d8817e4Smiod      const char *msgid;
52*3d8817e4Smiod {
53*3d8817e4Smiod   return DCGETTEXT (domainname, msgid, LC_MESSAGES);
54*3d8817e4Smiod }
55*3d8817e4Smiod 
56*3d8817e4Smiod #ifdef _LIBC
57*3d8817e4Smiod /* Alias for function name in GNU C Library.  */
58*3d8817e4Smiod weak_alias (__dgettext, dgettext);
59*3d8817e4Smiod #endif
60