diff options
author | KO Myung-Hun <komh78@gmail.com> | 2016-01-12 11:35:48 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2016-01-20 11:38:19 +0900 |
commit | 2a23de5580dbe5d6ab67432b9b54e9b8cbc03e7c (patch) | |
tree | 0472239d8cb2c0034f2c9c27410116aaec5d2f6e /gettext-runtime | |
parent | 9c6af038865c4ad8644b5b5a10afc7f7972ecd66 (diff) | |
download | external_gettext-2a23de5580dbe5d6ab67432b9b54e9b8cbc03e7c.zip external_gettext-2a23de5580dbe5d6ab67432b9b54e9b8cbc03e7c.tar.gz external_gettext-2a23de5580dbe5d6ab67432b9b54e9b8cbc03e7c.tar.bz2 |
intl: Support UNIXROOT in BINDTEXTDOMAIN () on EMX
$UNIXROOT is a drive on which a root of FHS is.
* gettext-runtime/intl/bindtextdom.c (BINDTEXTDOMAIN): Prepend
$UNIXROOT to dirname if it is started '/' or it is an empty string.
Diffstat (limited to 'gettext-runtime')
-rw-r--r-- | gettext-runtime/intl/bindtextdom.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gettext-runtime/intl/bindtextdom.c b/gettext-runtime/intl/bindtextdom.c index bbb23b9..bd82f1a 100644 --- a/gettext-runtime/intl/bindtextdom.c +++ b/gettext-runtime/intl/bindtextdom.c @@ -317,7 +317,33 @@ set_binding_values (const char *domainname, char * BINDTEXTDOMAIN (const char *domainname, const char *dirname) { +#ifdef __EMX__ + const char *saved_dirname = dirname; + char dirname_with_drive[_MAX_PATH]; + + /* Resolve UNIXROOT into dirname if it is not resolved by os2compat.[ch]. */ + if (dirname && (dirname[0] == '/' || dirname[0] == '\\' )) + { + const char *unixroot = getenv ("UNIXROOT"); + size_t len = strlen (dirname) + 1; + + if (unixroot + && unixroot[0] != '\0' + && unixroot[1] == ':' + && unixroot[2] == '\0' + && 2 + len <= _MAX_PATH) + { + memcpy (dirname_with_drive, unixroot, 2); + memcpy (dirname_with_drive + 2, dirname, len); + + dirname = dirname_with_drive; + } + } +#endif set_binding_values (domainname, &dirname, NULL); +#ifdef __EMX__ + dirname = saved_dirname; +#endif return (char *) dirname; } |