root / intl / ngettext.c @ 22
History | View | Annotate | Download (1.9 kB)
| 1 | 1 | hiro | /* Implementation of ngettext(3) function.
|
|---|---|---|---|
| 2 | 1 | hiro | Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc. |
| 3 | 1 | hiro | |
| 4 | 1 | hiro | This program is free software; you can redistribute it and/or modify it |
| 5 | 1 | hiro | under the terms of the GNU Library General Public License as published |
| 6 | 1 | hiro | by the Free Software Foundation; either version 2, or (at your option) |
| 7 | 1 | hiro | any later version. |
| 8 | 1 | hiro | |
| 9 | 1 | hiro | This program is distributed in the hope that it will be useful, |
| 10 | 1 | hiro | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | 1 | hiro | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | 1 | hiro | Library General Public License for more details. |
| 13 | 1 | hiro | |
| 14 | 1 | hiro | You should have received a copy of the GNU Library General Public |
| 15 | 1 | hiro | License along with this program; if not, write to the Free Software |
| 16 | 1 | hiro | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 17 | 1 | hiro | USA. */ |
| 18 | 1 | hiro | |
| 19 | 1 | hiro | #ifdef HAVE_CONFIG_H
|
| 20 | 1 | hiro | # include <config.h> |
| 21 | 1 | hiro | #endif
|
| 22 | 1 | hiro | |
| 23 | 1 | hiro | #ifdef _LIBC
|
| 24 | 1 | hiro | # define __need_NULL
|
| 25 | 1 | hiro | # include <stddef.h> |
| 26 | 1 | hiro | #else
|
| 27 | 1 | hiro | # include <stdlib.h> /* Just for NULL. */ |
| 28 | 1 | hiro | #endif
|
| 29 | 1 | hiro | |
| 30 | 1 | hiro | #include "gettextP.h" |
| 31 | 1 | hiro | #ifdef _LIBC
|
| 32 | 1 | hiro | # include <libintl.h> |
| 33 | 1 | hiro | #else
|
| 34 | 1 | hiro | # include "libgnuintl.h" |
| 35 | 1 | hiro | #endif
|
| 36 | 1 | hiro | |
| 37 | 1 | hiro | #include <locale.h> |
| 38 | 1 | hiro | |
| 39 | 1 | hiro | /* @@ end of prolog @@ */
|
| 40 | 1 | hiro | |
| 41 | 1 | hiro | /* Names for the libintl functions are a problem. They must not clash
|
| 42 | 1 | hiro | with existing names and they should follow ANSI C. But this source |
| 43 | 1 | hiro | code is also used in GNU C Library where the names have a __ |
| 44 | 1 | hiro | prefix. So we have to make a difference here. */ |
| 45 | 1 | hiro | #ifdef _LIBC
|
| 46 | 1 | hiro | # define NGETTEXT __ngettext
|
| 47 | 1 | hiro | # define DCNGETTEXT __dcngettext
|
| 48 | 1 | hiro | #else
|
| 49 | 1 | hiro | # define NGETTEXT libintl_ngettext
|
| 50 | 1 | hiro | # define DCNGETTEXT libintl_dcngettext
|
| 51 | 1 | hiro | #endif
|
| 52 | 1 | hiro | |
| 53 | 1 | hiro | /* Look up MSGID in the current default message catalog for the current
|
| 54 | 1 | hiro | LC_MESSAGES locale. If not found, returns MSGID itself (the default |
| 55 | 1 | hiro | text). */ |
| 56 | 1 | hiro | char *
|
| 57 | 1 | hiro | NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n) |
| 58 | 1 | hiro | {
|
| 59 | 1 | hiro | return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES); |
| 60 | 1 | hiro | } |
| 61 | 1 | hiro | |
| 62 | 1 | hiro | #ifdef _LIBC
|
| 63 | 1 | hiro | /* Alias for function name in GNU C Library. */
|
| 64 | 1 | hiro | weak_alias (__ngettext, ngettext); |
| 65 | 1 | hiro | #endif |