diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-05-25 20:23:09 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-05-25 20:23:09 (GMT) |
commit | 6b060d7e6be54b516c2dd12b93b8457ea8a68a02 (patch) | |
tree | 3c30201c8487a0dded322bf300b1de4911cb0aba | |
parent | 45aaf371ff8cbe786c9efba77154b41f60274178 (diff) | |
parent | 621d3d100215359bf2411b11c66d197eb6530a61 (diff) | |
download | tcl-6b060d7e6be54b516c2dd12b93b8457ea8a68a02.zip tcl-6b060d7e6be54b516c2dd12b93b8457ea8a68a02.tar.gz tcl-6b060d7e6be54b516c2dd12b93b8457ea8a68a02.tar.bz2 |
Remove useless code, trying to sync win32 environment variables with cygwin's. cygwin1.dll is responsible for doing that. Taken over from cygwin's tcl fork.
-rw-r--r-- | generic/tclEnv.c | 99 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 3 |
2 files changed, 1 insertions, 101 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c index cd1a954..2cb240d 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -43,11 +43,6 @@ static char * EnvTraceProc(ClientData clientData, Tcl_Interp *interp, static void ReplaceString(const char *oldStr, char *newStr); MODULE_SCOPE void TclSetEnv(const char *name, const char *value); MODULE_SCOPE void TclUnsetEnv(const char *name); - -#if defined(__CYGWIN__) - static void TclCygwinPutenv(char *string); -# define putenv TclCygwinPutenv -#endif /* *---------------------------------------------------------------------- @@ -444,7 +439,7 @@ TclUnsetEnv( * that no = should be included, and Windows requires it. */ -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) string = ckalloc(length + 2); memcpy(string, name, (size_t) length); string[length] = '='; @@ -740,98 +735,6 @@ TclFinalizeEnvironment(void) } } -#if defined(__CYGWIN__) - -/* - * When using cygwin, when an environment variable changes, we need to synch - * with both the cygwin environment (in case the application C code calls - * fork) and the Windows environment (in case the application TCL code calls - * exec, which calls the Windows CreateProcess function). - */ -DLLIMPORT extern void __stdcall SetEnvironmentVariableA(const char*, const char *); - -static void -TclCygwinPutenv( - char *str) -{ - char *name, *value; - - /* - * Get the name and value, so that we can change the environment variable - * for Windows. - */ - - name = alloca(strlen(str) + 1); - strcpy(name, str); - for (value=name ; *value!='=' && *value!='\0' ; ++value) { - /* Empty body */ - } - if (*value == '\0') { - /* Can't happen. */ - return; - } - *(value++) = '\0'; - if (*value == '\0') { - value = NULL; - } - - /* - * Set the cygwin environment variable. - */ - -#undef putenv - if (value == NULL) { - unsetenv(name); - } else { - putenv(str); - } - - /* - * Before changing the environment variable in Windows, if this is PATH, - * we need to convert the value back to a Windows style path. - * - * FIXME: The calling program may know it is running under windows, and - * may have set the path to a Windows path, or, worse, appended or - * prepended a Windows path to PATH. - */ - - if (strcmp(name, "PATH") != 0) { - /* - * If this is Path, eliminate any PATH variable, to prevent any - * confusion. - */ - - if (strcmp(name, "Path") == 0) { - SetEnvironmentVariableA("PATH", NULL); - unsetenv("PATH"); - } - - SetEnvironmentVariableA(name, value); - } else { - char *buf; - - /* - * Eliminate any Path variable, to prevent any confusion. - */ - - SetEnvironmentVariableA("Path", NULL); - unsetenv("Path"); - - if (value == NULL) { - buf = NULL; - } else { - int size; - - size = cygwin_conv_path_list(0, value, NULL, 0); - buf = alloca(size + 1); - cygwin_conv_path_list(0, value, buf, size); - } - - SetEnvironmentVariableA(name, buf); - } -} -#endif /* __CYGWIN__ */ - /* * Local Variables: * mode: c diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index a9983be..123abec 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -98,9 +98,6 @@ typedef off_t Tcl_SeekOffset; __declspec(dllimport) extern __stdcall int SetFileAttributesW(const WCHAR *, int); __declspec(dllimport) extern int cygwin_conv_path(int, const void *, void *, int); - __declspec(dllimport) extern int cygwin_conv_path_list(int, const void *, void *, int); -# define USE_PUTENV 1 -# define USE_PUTENV_FOR_UNSET 1 /* On Cygwin, the environment is imported from the Cygwin DLL. */ #ifndef __x86_64__ # define environ __cygwin_environ |