OSDN Git Service

Default changed to IMA compiling, disabled explicitely where currently not possible...
[uclinux-h8/uClibc.git] / libintl / intl.c
1 /*  Copyright (C) 2003     Manuel Novoa III
2  *
3  *  This library is free software; you can redistribute it and/or
4  *  modify it under the terms of the GNU Library General Public
5  *  License as published by the Free Software Foundation; either
6  *  version 2 of the License, or (at your option) any later version.
7  *
8  *  This library is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  *  Library General Public License for more details.
12  *
13  *  You should have received a copy of the GNU Library General Public
14  *  License along with this library; if not, write to the Free
15  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  */
17
18 /*
19  *  Stub version of libintl.
20  *
21  *  Aug 30, 2003
22  *  Add some hidden names to support locale-enabled libstd++.
23  */
24
25 #include <stdlib.h>
26 #include <string.h>
27 #include <errno.h>
28
29 #undef __OPTIMIZE__
30 #include <libintl.h>
31
32 /**********************************************************************/
33 #ifdef L_gettext
34
35 char *gettext(const char *msgid)
36 {
37         return (char *) msgid;
38 }
39
40 #endif
41 /**********************************************************************/
42 #ifdef L_dgettext
43
44 char *__dgettext(const char *domainname,
45                                  const char *msgid)
46 {
47         return (char *) msgid;
48 }
49
50 strong_alias(__dgettext, dgettext)
51
52 #endif
53 /**********************************************************************/
54 #ifdef L_dcgettext
55
56 char *__dcgettext(const char *domainname,
57                                   const char *msgid, int category)
58 {
59         return (char *) msgid;
60 }
61
62 strong_alias(__dcgettext, dcgettext)
63
64 #endif
65 /**********************************************************************/
66 #ifdef L_ngettext
67
68 char *ngettext(const char *msgid1, const char *msgid2,
69                            unsigned long int n)
70 {
71         return (char *) ((n == 1) ? msgid1 : msgid2);
72 }
73
74 #endif
75 /**********************************************************************/
76 #ifdef L_dngettext
77
78 char *dngettext(const char *domainname, const char *msgid1,
79                                 const char *msgid2, unsigned long int n)
80 {
81         return (char *) ((n == 1) ? msgid1 : msgid2);
82 }
83
84 #endif
85 /**********************************************************************/
86 #ifdef L_dcngettext
87
88 char *dcngettext(const char *domainname, const char *msgid1,
89                                  const char *msgid2, unsigned long int n,
90                                  int category)
91 {
92         return (char *) ((n == 1) ? msgid1 : msgid2);
93 }
94
95 #endif
96 /**********************************************************************/
97 #ifdef L_textdomain
98
99 char *__textdomain(const char *domainname)
100 {
101         static const char default_str[] = "messages";
102
103         if (domainname && *domainname && strcmp(domainname, default_str)) {
104                 __set_errno(EINVAL);
105                 return NULL;
106         }
107         return (char *) default_str;
108 }
109
110 strong_alias(__textdomain, textdomain)
111
112 #endif
113 /**********************************************************************/
114 #ifdef L_bindtextdomain
115
116 char *__bindtextdomain(const char *domainname, const char *dirname)
117 {
118         static const char dir[] = "/";
119
120         if (!domainname || !*domainname
121                 || (dirname
122 #if 1
123                         && ((dirname[0] != '/') || dirname[1])
124 #else
125                         && strcmp(dirname, dir)
126 #endif
127                         )
128                 ) {
129                 __set_errno(EINVAL);
130                 return NULL;
131         }
132
133         return (char *) dir;
134 }
135
136 strong_alias(__bindtextdomain, bindtextdomain)
137
138 #endif
139 /**********************************************************************/
140 #ifdef L_bind_textdomain_codeset
141
142 /* Specify the character encoding in which the messages from the
143    DOMAINNAME message catalog will be returned.  */
144 char *bind_textdomain_codeset(const char *domainname,
145                                                                                         const char *codeset)
146 {
147         if (!domainname || !*domainname || codeset) {
148                 __set_errno(EINVAL);
149         }
150         return NULL;
151 }
152
153 #endif
154 /**********************************************************************/
155 #ifdef L__nl_expand_alias
156
157 /* glibc-ism */
158
159 const char *_nl_expand_alias(const char * name)
160 {
161         return NULL;             /* uClibc does not support locale aliases. */
162 }
163
164 #endif
165 /**********************************************************************/
166 #ifdef L__nl_msg_cat_cntr
167
168 /* glibc-ism */
169
170 int _nl_msg_cat_cntr = 0;
171
172 #endif
173 /**********************************************************************/