Tcl Source Code

Check-in [d39be5f098]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:cygwin should use SetEnvironmentVariable for windows env
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: d39be5f098621b64f27c6399db7315d2a6039545
User & Date: jan.nijtmans 2012-04-05 07:07:10
Context
2012-04-11
19:50
[Bug 3448512]: clock scan "1958-01-01" fails only in debug compilation check-in: beba7a8c8c user: jan.nijtmans tags: core-8-5-branch
2012-04-06
23:42
cygwin should use SetEnvironmentVariable for windows env Closed-Leaf check-in: b154f7f607 user: jan.nijtmans tags: cygwin-environment-changes
2012-04-05
07:07
cygwin should use SetEnvironmentVariable for windows env check-in: d39be5f098 user: jan.nijtmans tags: core-8-5-branch
2012-04-04
20:17
some formatting (*.decls) move up #undef, for macro which is conflicting with later stuff. remove so... check-in: 904f4fe3fe user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclEnv.c.

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
static char *		EnvTraceProc(ClientData clientData, Tcl_Interp *interp,
			    const char *name1, const char *name2, int flags);
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__)
/* On Cygwin, the environment is imported from the Cygwin DLL. */
     DLLIMPORT extern int cygwin_posix_to_win32_path_list_buf_size(char *value);
     DLLIMPORT extern void cygwin_posix_to_win32_path_list(char *buf, char *value);
#    define putenv TclCygwinPutenv
static void		TclCygwinPutenv(char *string);
#endif

/*
 *----------------------------------------------------------------------
 *
 * TclSetupEnv --
 *







<
|
<
|
<







41
42
43
44
45
46
47

48

49

50
51
52
53
54
55
56
static char *		EnvTraceProc(ClientData clientData, Tcl_Interp *interp,
			    const char *name1, const char *name2, int flags);
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

/*
 *----------------------------------------------------------------------
 *
 * TclSetupEnv --
 *
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
    if (strcmp(name, "PATH") != 0) {
	/*
	 * If this is Path, eliminate any PATH variable, to prevent any
	 * confusion.
	 */

	if (strcmp(name, "Path") == 0) {
#ifdef __WIN32__
	    SetEnvironmentVariable("PATH", NULL);
#endif
	    unsetenv("PATH");
	}

#ifdef __WIN32__
	SetEnvironmentVariable(name, value);
#endif
    } else {
	char *buf;

	/*
	 * Eliminate any Path variable, to prevent any confusion.
	 */

#ifdef __WIN32__
	SetEnvironmentVariable("Path", NULL);
#endif
	unsetenv("Path");

	if (value == NULL) {
	    buf = NULL;
	} else {
	    int size;

	    size = cygwin_posix_to_win32_path_list_buf_size(value);
	    buf = alloca(size + 1);
	    cygwin_posix_to_win32_path_list(value, buf);
	}

#ifdef __WIN32__
	SetEnvironmentVariable(name, buf);
#endif
    }
}
#endif /* __CYGWIN__ */

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */







<
|
<



<
|
<







<
|
<












<
|
<











746
747
748
749
750
751
752

753

754
755
756

757

758
759
760
761
762
763
764

765

766
767
768
769
770
771
772
773
774
775
776
777

778

779
780
781
782
783
784
785
786
787
788
789
    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_posix_to_win32_path_list_buf_size(value);
	    buf = alloca(size + 1);
	    cygwin_posix_to_win32_path_list(value, buf);
	}


	SetEnvironmentVariableA(name, buf);

    }
}
#endif /* __CYGWIN__ */

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */

Changes to generic/tclPort.h.

25
26
27
28
29
30
31


32
33
34
35


36
37
38
39
40
41
42
#   include "tclUnixPort.h"
#endif

#if defined(__CYGWIN__)
#   define USE_PUTENV 1
#   define USE_PUTENV_FOR_UNSET 1
/* On Cygwin, the environment is imported from the Cygwin DLL. */


    DLLIMPORT extern char **__cygwin_environ;
    DLLIMPORT extern int cygwin_conv_to_win32_path(const char *, char *);
#   define environ __cygwin_environ
#   define timezone _timezone


#endif

#if !defined(LLONG_MIN)
#   ifdef TCL_WIDE_INT_IS_LONG
#      define LLONG_MIN LONG_MIN
#   else
#      ifdef LLONG_BIT







>
>


|
<
>
>







25
26
27
28
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44
45
#   include "tclUnixPort.h"
#endif

#if defined(__CYGWIN__)
#   define USE_PUTENV 1
#   define USE_PUTENV_FOR_UNSET 1
/* On Cygwin, the environment is imported from the Cygwin DLL. */
#   define environ __cygwin_environ
#   define timezone _timezone
    DLLIMPORT extern char **__cygwin_environ;
    DLLIMPORT extern int cygwin_conv_to_win32_path(const char *, char *);
    DLLIMPORT extern int cygwin_posix_to_win32_path_list_buf_size(char *value);

    DLLIMPORT extern void cygwin_posix_to_win32_path_list(char *buf, char *value);
    DLLIMPORT extern void __stdcall SetEnvironmentVariableA(const char*, const char *);
#endif

#if !defined(LLONG_MIN)
#   ifdef TCL_WIDE_INT_IS_LONG
#      define LLONG_MIN LONG_MIN
#   else
#      ifdef LLONG_BIT