dgettext.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Implementation of the dgettext(3) function.
  2. Copyright (C) 1995-2019 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 2.1 of the License, or
  6. (at your option) 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
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #ifdef HAVE_CONFIG_H
  14. # include <config.h>
  15. #endif
  16. #include "gettextP.h"
  17. #include <locale.h>
  18. #ifdef _LIBC
  19. # include <libintl.h>
  20. #else
  21. # include "libgnuintl.h"
  22. #endif
  23. /* @@ end of prolog @@ */
  24. /* Names for the libintl functions are a problem. They must not clash
  25. with existing names and they should follow ANSI C. But this source
  26. code is also used in GNU C Library where the names have a __
  27. prefix. So we have to make a difference here. */
  28. #ifdef _LIBC
  29. # define DGETTEXT __dgettext
  30. # define DCGETTEXT __dcgettext
  31. #else
  32. # define DGETTEXT libintl_dgettext
  33. # define DCGETTEXT libintl_dcgettext
  34. #endif
  35. /* Look up MSGID in the DOMAINNAME message catalog of the current
  36. LC_MESSAGES locale. */
  37. char *
  38. DGETTEXT (const char *domainname, const char *msgid)
  39. {
  40. return DCGETTEXT (domainname, msgid, LC_MESSAGES);
  41. }
  42. #ifdef _LIBC
  43. /* Alias for function name in GNU C Library. */
  44. weak_alias (__dgettext, dgettext);
  45. #endif