ARC defconfigs
[uclibc-ng.git] / libintl / intl.c
blobe42a999cb2513101ba0cb9514dfe01ee93c644c4
1 /* Copyright (C) 2003 Manuel Novoa III
2 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5 */
7 /*
8 * Stub version of libintl.
10 * Aug 30, 2003
11 * Add some hidden names to support locale-enabled libstd++.
14 #include <stdlib.h>
15 #include <string.h>
16 #include <errno.h>
18 #undef __OPTIMIZE__
19 #include <libintl.h>
21 /**********************************************************************/
22 #ifdef L_gettext
24 char *gettext(const char *msgid)
26 return (char *) msgid;
29 #endif
30 /**********************************************************************/
31 #ifdef L_dgettext
33 char *dgettext(const char *domainname,
34 const char *msgid)
36 return (char *) msgid;
39 #endif
40 /**********************************************************************/
41 #ifdef L_dcgettext
43 char *dcgettext(const char *domainname,
44 const char *msgid, int category)
46 return (char *) msgid;
49 #endif
50 /**********************************************************************/
51 #ifdef L_ngettext
53 char *ngettext(const char *msgid1, const char *msgid2,
54 unsigned long int n)
56 return (char *) ((n == 1) ? msgid1 : msgid2);
59 #endif
60 /**********************************************************************/
61 #ifdef L_dngettext
63 char *dngettext(const char *domainname, const char *msgid1,
64 const char *msgid2, unsigned long int n)
66 return (char *) ((n == 1) ? msgid1 : msgid2);
69 #endif
70 /**********************************************************************/
71 #ifdef L_dcngettext
73 char *dcngettext(const char *domainname, const char *msgid1,
74 const char *msgid2, unsigned long int n,
75 int category)
77 return (char *) ((n == 1) ? msgid1 : msgid2);
80 #endif
81 /**********************************************************************/
82 #ifdef L_textdomain
84 char *textdomain(const char *domainname)
86 static const char default_str[] = "messages";
88 if (domainname && *domainname && strcmp(domainname, default_str)) {
89 __set_errno(EINVAL);
90 return NULL;
92 return (char *) default_str;
95 #endif
96 /**********************************************************************/
97 #ifdef L_bindtextdomain
99 char *bindtextdomain(const char *domainname, const char *dirname)
101 static const char dir[] = "/";
103 if (!domainname || !*domainname
104 || (dirname
105 #if 1
106 && ((dirname[0] != '/') || dirname[1])
107 #else
108 && strcmp(dirname, dir)
109 #endif
112 __set_errno(EINVAL);
113 return NULL;
116 return (char *) dir;
119 #endif
120 /**********************************************************************/
121 #ifdef L_bind_textdomain_codeset
123 /* Specify the character encoding in which the messages from the
124 DOMAINNAME message catalog will be returned. */
125 char *bind_textdomain_codeset(const char *domainname, const char *codeset)
127 if (!domainname || !*domainname || codeset) {
128 __set_errno(EINVAL);
130 return NULL;
133 #endif
134 /**********************************************************************/
135 #ifdef L__nl_expand_alias
137 /* glibc-ism */
139 const char *_nl_expand_alias(const char * name);
140 const char *_nl_expand_alias(const char * name)
142 return NULL; /* uClibc does not support locale aliases. */
145 #endif
146 /**********************************************************************/
147 #ifdef L__nl_msg_cat_cntr
149 /* glibc-ism */
151 int _nl_msg_cat_cntr = 0;
153 #endif
154 /**********************************************************************/