summaryrefslogtreecommitdiffstats
path: root/win/tclWinInit.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-14 22:02:00 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-03-14 22:02:00 (GMT)
commita98d79021f17d79a3e159b3da043972466bb315d (patch)
treeeffba24c17d8545e764797ed5ce38c71ad76c44e /win/tclWinInit.c
parent49b167a3881644c6aee6b73d87e4edd13a50ce29 (diff)
parent6751485187087a5d96253b9d52e1e01b33e0c1a4 (diff)
downloadtcl-a98d79021f17d79a3e159b3da043972466bb315d.zip
tcl-a98d79021f17d79a3e159b3da043972466bb315d.tar.gz
tcl-a98d79021f17d79a3e159b3da043972466bb315d.tar.bz2
Merge 8.7
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r--win/tclWinInit.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 5524850..fe99416 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -625,6 +625,16 @@ TclpSetVariables(
*----------------------------------------------------------------------
*/
+#if defined(_WIN32)
+# define tenviron _wenviron
+# define tenviron2utfdstr(tenvstr, len, dstr) \
+ Tcl_WinTCharToUtf((TCHAR *)tenvstr, len, dstr)
+#else
+# define tenviron environ
+# define tenviron2utfdstr(tenvstr, len, dstr) \
+ Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr)
+#endif
+
size_t
TclpFindVariable(
const char *name, /* Name of desired environment variable
@@ -649,14 +659,16 @@ TclpFindVariable(
Tcl_UtfToUpper(nameUpper);
Tcl_DStringInit(&envString);
- for (i = 0, env = environ[i]; env != NULL; i++, env = environ[i]) {
+ for (i = 0, env = (const char *)tenviron[i];
+ env != NULL;
+ i++, env = (const char *)tenviron[i]) {
/*
* Chop the env string off after the equal sign, then Convert the name
* to all upper case, so we do not have to convert all the characters
* after the equal sign.
*/
- envUpper = Tcl_ExternalToUtfDString(NULL, env, -1, &envString);
+ envUpper = tenviron2utfdstr(env, -1, &envString);
p1 = strchr(envUpper, '=');
if (p1 == NULL) {
continue;