[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gettext] [PATCH v3 2/4] intl: Support UNIXROOT in BINDTEXTDOMAIN ()
From: |
KO Myung-Hun |
Subject: |
[bug-gettext] [PATCH v3 2/4] intl: Support UNIXROOT in BINDTEXTDOMAIN () on EMX |
Date: |
Tue, 12 Jan 2016 11:35:48 +0900 |
$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.
---
gettext-runtime/intl/bindtextdom.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
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;
}
--
2.7.0