Last change
on this file since 367 was 337, checked in by coas-nagasima, 6 years ago |
ASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
799 bytes
|
Rev | Line | |
---|
[337] | 1 | #include <libintl.h>
|
---|
| 2 | #include <string.h>
|
---|
| 3 | #include <stdlib.h>
|
---|
| 4 | #include <errno.h>
|
---|
| 5 | #include <limits.h>
|
---|
| 6 | #include "libc.h"
|
---|
| 7 | #include "atomic.h"
|
---|
| 8 |
|
---|
| 9 | static char *current_domain;
|
---|
| 10 |
|
---|
| 11 | char *__gettextdomain()
|
---|
| 12 | {
|
---|
| 13 | return current_domain ? current_domain : "messages";
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | char *textdomain(const char *domainname)
|
---|
| 17 | {
|
---|
| 18 | if (!domainname) return __gettextdomain();
|
---|
| 19 |
|
---|
| 20 | size_t domlen = strlen(domainname);
|
---|
| 21 | if (domlen > NAME_MAX) {
|
---|
| 22 | errno = EINVAL;
|
---|
| 23 | return 0;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | if (!current_domain) {
|
---|
| 27 | current_domain = malloc(NAME_MAX+1);
|
---|
| 28 | if (!current_domain) return 0;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | memcpy(current_domain, domainname, domlen+1);
|
---|
| 32 |
|
---|
| 33 | return current_domain;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | char *gettext(const char *msgid)
|
---|
| 37 | {
|
---|
| 38 | return dgettext(0, msgid);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | char *ngettext(const char *msgid1, const char *msgid2, unsigned long int n)
|
---|
| 42 | {
|
---|
| 43 | return dngettext(0, msgid1, msgid2, n);
|
---|
| 44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.