summaryrefslogtreecommitdiffstats
path: root/generic/tclEnv.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 10:15:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 10:15:02 (GMT)
commit10f86a8692c0a3a978d81ff4ab06c6f04dde6d99 (patch)
tree2b91bafe7209fe7a322a5a7f9ec87572e868bf81 /generic/tclEnv.c
parent23f5b19d027c7c6f2eec97dd900569b56a9087f7 (diff)
downloadtcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.zip
tcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.tar.gz
tcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.tar.bz2
[Bug 3288345] Wrong Tcl_StatBuf used on Cygwin
(backported from Tcl 8.5)
Diffstat (limited to 'generic/tclEnv.c')
-rw-r--r--generic/tclEnv.c85
1 files changed, 6 insertions, 79 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 4ce1c3b..deb5dcd 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclEnv.c --
*
* Tcl support for environment variables, including a setenv
@@ -699,83 +699,10 @@ TclFinalizeEnvironment()
}
}
-#if defined(__CYGWIN__) && defined(__WIN32__)
-
-#include <windows.h>
-
/*
- * 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).
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
*/
-
-static void
-TclCygwinPutenv(str)
- const char *str;
-{
- char *name, *value;
-
- /* Get the name and value, so that we can change the environment
- variable for Windows. */
- name = (char *) alloca (strlen (str) + 1);
- strcpy (name, str);
- for (value = name; *value != '=' && *value != '\0'; ++value)
- ;
- if (*value == '\0') {
- /* Can't happen. */
- return;
- }
- *value = '\0';
- ++value;
- 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) {
- SetEnvironmentVariable ("PATH", (char *) NULL);
- unsetenv ("PATH");
- }
-
- SetEnvironmentVariable (name, value);
- } else {
- char *buf;
-
- /* Eliminate any Path variable, to prevent any confusion. */
- SetEnvironmentVariable ("Path", (char *) NULL);
- unsetenv ("Path");
-
- if (value == NULL) {
- buf = NULL;
- } else {
- int size;
-
- size = cygwin_posix_to_win32_path_list_buf_size (value);
- buf = (char *) alloca (size + 1);
- cygwin_posix_to_win32_path_list (value, buf);
- }
-
- SetEnvironmentVariable (name, buf);
- }
-}
-
-#endif /* __CYGWIN__ && __WIN32__ */