diff options
Diffstat (limited to 'libc/misc/intl')
-rw-r--r-- | libc/misc/intl/Makefile | 3 | ||||
-rw-r--r-- | libc/misc/intl/intl.c | 54 |
2 files changed, 52 insertions, 5 deletions
diff --git a/libc/misc/intl/Makefile b/libc/misc/intl/Makefile index 9975e5eb1..140ae31f3 100644 --- a/libc/misc/intl/Makefile +++ b/libc/misc/intl/Makefile @@ -25,7 +25,8 @@ TOPDIR=../../../ include $(TOPDIR)Rules.mak MSRC= intl.c -MOBJ= __uClibc_dgettext.o __uClibc_dcgettext.o +MOBJ= __uClibc_dgettext.o __uClibc_dcgettext.o \ + __uClibc_textdomain.o __uClibc_bindtextdomain.o # for libstd++ OBJS=$(MOBJ) diff --git a/libc/misc/intl/intl.c b/libc/misc/intl/intl.c index eca6fa96a..f3255828c 100644 --- a/libc/misc/intl/intl.c +++ b/libc/misc/intl/intl.c @@ -17,6 +17,9 @@ /* * Supply some weaks for use by strerror*(), etc. + * + * Aug 30, 2003 + * Add some hidden names to support locale-enabled libstd++. */ #include <stdlib.h> @@ -35,19 +38,62 @@ char *__uClibc_dgettext(const char *domainname, return (char *) msgid; } -weak_alias (__uClibc_dgettext, __dgettext) +weak_alias(__uClibc_dgettext, __dgettext) #endif /**********************************************************************/ #ifdef L___uClibc_dcgettext -char * __uClibc_dcgettext(const char *domainname, - const char *msgid, int category) +char *__uClibc_dcgettext(const char *domainname, + const char *msgid, int category) { return (char *) msgid; } -weak_alias (__uClibc_dcgettext, __dcgettext) +weak_alias(__uClibc_dcgettext, __dcgettext) + +#endif +/**********************************************************************/ +#ifdef L___uClibc_textdomain + +char *__uClibc_textdomain(const char *domainname) +{ + static const char default_str[] = "messages"; + + if (domainname && *domainname && strcmp(domainname, default_str)) { + __set_errno(EINVAL); + return NULL; + } + return (char *) default_str; +} + +weak_alias(__uClibc_textdomain, __textdomain) + +#endif +/**********************************************************************/ +#ifdef L___uClibc_bindtextdomain + +char *__uClibc_bindtextdomain(const char *domainname, const char *dirname) +{ + static const char dir[] = "/"; + + if (!domainname || !*domainname + || (dirname +#if 1 + && ((dirname[0] != '/') || dirname[1]) +#else + && strcmp(dirname, dir) +#endif + ) + ) { + __set_errno(EINVAL); + return NULL; + } + + return (char *) dir; +} + +weak_alias(__uClibc_bindtextdomain, __bindtextdomain) #endif /**********************************************************************/ |