gettext.c 1.88 KB
Newer Older
Jeff Law committed
1
/* Implementation of gettext(3) function.
2
   Copyright (C) 1995, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
Jeff Law committed
3

4 5 6
   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU Library General Public License as published
   by the Free Software Foundation; either version 2, or (at your option)
Jeff Law committed
7 8 9 10
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11 12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.
Jeff Law committed
13

14 15
   You should have received a copy of the GNU Library General Public
   License along with this program; if not, write to the Free Software
16
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
17
   USA.  */
Jeff Law committed
18 19 20 21 22 23 24 25 26

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#ifdef _LIBC
# define __need_NULL
# include <stddef.h>
#else
27
# include <stdlib.h>		/* Just for NULL.  */
Jeff Law committed
28 29
#endif

30
#include "gettextP.h"
Jeff Law committed
31 32 33
#ifdef _LIBC
# include <libintl.h>
#else
34
# include "libgnuintl.h"
Jeff Law committed
35 36 37 38 39 40 41 42 43 44
#endif

/* @@ end of prolog @@ */

/* Names for the libintl functions are a problem.  They must not clash
   with existing names and they should follow ANSI C.  But this source
   code is also used in GNU C Library where the names have a __
   prefix.  So we have to make a difference here.  */
#ifdef _LIBC
# define GETTEXT __gettext
45
# define DCGETTEXT INTUSE(__dcgettext)
Jeff Law committed
46
#else
47 48
# define GETTEXT libintl_gettext
# define DCGETTEXT libintl_dcgettext
Jeff Law committed
49 50 51 52 53 54 55 56 57
#endif

/* Look up MSGID in the current default message catalog for the current
   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
   text).  */
char *
GETTEXT (msgid)
     const char *msgid;
{
58
  return DCGETTEXT (NULL, msgid, LC_MESSAGES);
Jeff Law committed
59 60 61 62 63 64
}

#ifdef _LIBC
/* Alias for function name in GNU C Library.  */
weak_alias (__gettext, gettext);
#endif