diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-10 21:21:39 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-10 21:21:39 (GMT) |
commit | ae2a5363a3d3f389ea5eb20f5ecadfa2c383e3d7 (patch) | |
tree | bff4adbbdbfab9d28a657f39ebc63798ea1290da /win/tclWinInit.c | |
parent | 5821819beb533be62fbc629b7b69b10d20670556 (diff) | |
parent | 67af6004fc9da2b948a387b7687239c164ca8a4f (diff) | |
download | tcl-ae2a5363a3d3f389ea5eb20f5ecadfa2c383e3d7.zip tcl-ae2a5363a3d3f389ea5eb20f5ecadfa2c383e3d7.tar.gz tcl-ae2a5363a3d3f389ea5eb20f5ecadfa2c383e3d7.tar.bz2 |
Merge 8.7
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r-- | win/tclWinInit.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 803e466..44067aa 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -83,11 +83,10 @@ typedef struct { TclWinProcs tclWinProcs; /* - * The following arrays contain the human readable strings for the Windows + * The following arrays contain the human readable strings for the * processor values. */ - #define NUMPROCESSORS 11 static const char *const processors[NUMPROCESSORS] = { "intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil", @@ -540,7 +539,8 @@ TclpSetVariables( Tcl_SetVar2(interp, "tcl_platform", "platform", "windows", TCL_GLOBAL_ONLY); - Tcl_SetVar2(interp, "tcl_platform", "os", "Windows NT", TCL_GLOBAL_ONLY); + Tcl_SetVar2(interp, "tcl_platform", "os", + "Windows NT", TCL_GLOBAL_ONLY); wsprintfA(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion); Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY); if (sys.oemId.wProcessorArchitecture < NUMPROCESSORS) { @@ -624,6 +624,16 @@ TclpSetVariables( *---------------------------------------------------------------------- */ +#if defined(_WIN32) +# define tenviron _wenviron +# define tenviron2utfdstr(string, len, dsPtr) (Tcl_DStringInit(dsPtr), \ + (char *)Tcl_Char16ToUtfDString((const unsigned short *)(string), ((((len) + 2) >> 1) - 1), (dsPtr))) +#else +# define tenviron environ +# define tenviron2utfdstr(tenvstr, len, dstr) \ + Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr) +#endif + int TclpFindVariable( const char *name, /* Name of desired environment variable @@ -648,14 +658,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; |