1 #include <stdlib.h>
2 #include <string.h>
3 #include <strings.h>
4 #include <errno.h>
5
gettext(const char * msgid)6 char *gettext(const char *msgid)
7 {
8 return (char *) msgid;
9 }
10
dgettext(const char * domainname,const char * msgid)11 char *dgettext(const char *domainname, const char *msgid)
12 {
13 return (char *) msgid;
14 }
15
dcgettext(const char * domainname,const char * msgid,int category)16 char *dcgettext(const char *domainname, const char *msgid, int category)
17 {
18 return (char *) msgid;
19 }
20
ngettext(const char * msgid1,const char * msgid2,unsigned long int n)21 char *ngettext(const char *msgid1, const char *msgid2, unsigned long int n)
22 {
23 return (char *) ((n == 1) ? msgid1 : msgid2);
24 }
25
dngettext(const char * domainname,const char * msgid1,const char * msgid2,unsigned long int n)26 char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n)
27 {
28 return (char *) ((n == 1) ? msgid1 : msgid2);
29 }
30
dcngettext(const char * domainname,const char * msgid1,const char * msgid2,unsigned long int n,int category)31 char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category)
32 {
33 return (char *) ((n == 1) ? msgid1 : msgid2);
34 }
35
textdomain(const char * domainname)36 char *textdomain(const char *domainname)
37 {
38 static const char default_str[] = "messages";
39
40 if (domainname && *domainname && strcmp(domainname, default_str)) {
41 errno = EINVAL;
42 return NULL;
43 }
44 return (char *) default_str;
45 }
46
bindtextdomain(const char * domainname,const char * dirname)47 char *bindtextdomain(const char *domainname, const char *dirname)
48 {
49 static const char dir[] = "/";
50
51 if (!domainname || !*domainname
52 || (dirname && ((dirname[0] != '/') || dirname[1]))
53 ) {
54 errno = EINVAL;
55 return NULL;
56 }
57
58 return (char *) dir;
59 }
60
bind_textdomain_codeset(const char * domainname,const char * codeset)61 char *bind_textdomain_codeset(const char *domainname, const char *codeset)
62 {
63 if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) {
64 errno = EINVAL;
65 }
66 return NULL;
67 }
68