diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-02-12 00:22:29 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-02-12 00:22:29 -0500 |
commit | 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 (patch) | |
tree | 6eaef0d8a720fa3da580de87b647fff796fe80b3 /src/locale/intl.c | |
download | musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.gz musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.xz musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.zip |
initial check-in, version 0.5.0 v0.5.0
Diffstat (limited to 'src/locale/intl.c')
-rw-r--r-- | src/locale/intl.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/locale/intl.c b/src/locale/intl.c new file mode 100644 index 00000000..964f7da1 --- /dev/null +++ b/src/locale/intl.c @@ -0,0 +1,67 @@ +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <errno.h> + +char *gettext(const char *msgid) +{ + return (char *) msgid; +} + +char *dgettext(const char *domainname, const char *msgid) +{ + return (char *) msgid; +} + +char *dcgettext(const char *domainname, const char *msgid, int category) +{ + return (char *) msgid; +} + +char *ngettext(const char *msgid1, const char *msgid2, unsigned long int n) +{ + return (char *) ((n == 1) ? msgid1 : msgid2); +} + +char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n) +{ + return (char *) ((n == 1) ? msgid1 : msgid2); +} + +char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category) +{ + return (char *) ((n == 1) ? msgid1 : msgid2); +} + +char *textdomain(const char *domainname) +{ + static const char default_str[] = "messages"; + + if (domainname && *domainname && strcmp(domainname, default_str)) { + errno = EINVAL; + return NULL; + } + return (char *) default_str; +} + +char *bindtextdomain(const char *domainname, const char *dirname) +{ + static const char dir[] = "/"; + + if (!domainname || !*domainname + || (dirname && ((dirname[0] != '/') || dirname[1])) + ) { + errno = EINVAL; + return NULL; + } + + return (char *) dir; +} + +char *bind_textdomain_codeset(const char *domainname, const char *codeset) +{ + if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) { + errno = EINVAL; + } + return NULL; +} |