dgettext.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Implementation of the dgettext(3) function.
  2. Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU Library General Public License as published
  5. by the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
  14. USA. */
  15. #ifdef HAVE_CONFIG_H
  16. # include <config.h>
  17. #endif
  18. #include "gettextP.h"
  19. #include <locale.h>
  20. #ifdef _LIBC
  21. # include <libintl.h>
  22. #else
  23. # include "libgnuintl.h"
  24. #endif
  25. /* @@ end of prolog @@ */
  26. /* Names for the libintl functions are a problem. They must not clash
  27. with existing names and they should follow ANSI C. But this source
  28. code is also used in GNU C Library where the names have a __
  29. prefix. So we have to make a difference here. */
  30. #ifdef _LIBC
  31. # define DGETTEXT __dgettext
  32. # define DCGETTEXT INTUSE(__dcgettext)
  33. #else
  34. # define DGETTEXT libintl_dgettext
  35. # define DCGETTEXT libintl_dcgettext
  36. #endif
  37. /* Look up MSGID in the DOMAINNAME message catalog of the current
  38. LC_MESSAGES locale. */
  39. char *
  40. DGETTEXT (domainname, msgid)
  41. const char *domainname;
  42. const char *msgid;
  43. {
  44. return DCGETTEXT (domainname, msgid, LC_MESSAGES);
  45. }
  46. #ifdef _LIBC
  47. /* Alias for function name in GNU C Library. */
  48. weak_alias (__dgettext, dgettext);
  49. #endif