ngettext.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Implementation of ngettext(3) function.
  2. Copyright (C) 1995, 1997, 2000, 2001 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 General Public License as published by
  5. 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
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #ifdef HAVE_CONFIG_H
  15. # include <config.h>
  16. #endif
  17. #ifdef _LIBC
  18. # define __need_NULL
  19. # include <stddef.h>
  20. #else
  21. # include <stdlib.h> /* Just for NULL. */
  22. #endif
  23. #include "gettextP.h"
  24. #ifdef _LIBC
  25. # include <libintl.h>
  26. #else
  27. # include "libgnuintl.h"
  28. #endif
  29. #include <locale.h>
  30. /* @@ end of prolog @@ */
  31. /* Names for the libintl functions are a problem. They must not clash
  32. with existing names and they should follow ANSI C. But this source
  33. code is also used in GNU C Library where the names have a __
  34. prefix. So we have to make a difference here. */
  35. #ifdef _LIBC
  36. # define NGETTEXT __ngettext
  37. # define DCNGETTEXT __dcngettext
  38. #else
  39. # define NGETTEXT ngettext__
  40. # define DCNGETTEXT dcngettext__
  41. #endif
  42. /* Look up MSGID in the current default message catalog for the current
  43. LC_MESSAGES locale. If not found, returns MSGID itself (the default
  44. text). */
  45. char *
  46. NGETTEXT (msgid1, msgid2, n)
  47. const char *msgid1;
  48. const char *msgid2;
  49. unsigned long int n;
  50. {
  51. return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
  52. }
  53. #ifdef _LIBC
  54. /* Alias for function name in GNU C Library. */
  55. weak_alias (__ngettext, ngettext);
  56. #endif