diff options
author | Christopher Faylor <me@cgf.cx> | 2006-02-02 22:55:45 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-02-02 22:55:45 +0300 |
commit | 6577c186c972ad4b75e4854c8c261f6cf34bf5cc (patch) | |
tree | 29065d8de0a96af66433bb3c5cd9896d8f2cbc39 /winsup | |
parent | bb6f800d1840dfb870fa5af01c5884317330bdf6 (diff) |
* external.cc (setup_winenv): New function.
(cygwin_internal): Implement CW_SETUP_WINENV.
* sys/cygwin.h (cygwin_getinfo_types): Define CW_SETUP_WINENV.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/external.cc | 24 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/cygwin.h | 3 |
3 files changed, 32 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7d75b8a0b..8e50fd686 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2006-02-02 Christopher Faylor <cgf@timesys.com> + + * external.cc (setup_winenv): New function. + (cygwin_internal): Implement CW_SETUP_WINENV. + * sys/cygwin.h (cygwin_getinfo_types): Define CW_SETUP_WINENV. + 2006-02-02 Corinna Vinschen <corinna@vinschen.de> * security.cc (is_group_member): Fix comment. diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index dc83f7b51..3e593e418 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -28,7 +28,9 @@ details. */ #include "pwdgrp.h" #include "cygtls.h" #include "child_info.h" +#include "environ.h" #include <unistd.h> +#include <stdlib.h> child_info *get_cygwin_startup_info (); @@ -133,6 +135,25 @@ check_ntsec (const char *filename) return allow_ntsec && pc.has_acls (); } +/* Copy cygwin environment variables to the Windows environment. */ +static void +setup_winenv () +{ + char **envp = __cygwin_environ; + char *var, *val; + char dummy; + + while (envp && *envp) + { + var = strdup (*envp++); + val = strchr (var, '='); + *val++ = '\0'; + if (!GetEnvironmentVariable (var, &dummy, 1)) + SetEnvironmentVariable (var, val); + free (var); + } +} + extern "C" unsigned long cygwin_internal (cygwin_getinfo_types t, ...) { @@ -312,6 +333,9 @@ cygwin_internal (cygwin_getinfo_types t, ...) error_start_init (va_arg (arg, const char *)); try_to_debug (); break; + case CW_SETUP_WINENV: + setup_winenv (); + return 0; default: break; } diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index fe4aea402..0e177e9a0 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -85,7 +85,8 @@ typedef enum CW_HOOK, CW_ARGV, CW_ENVP, - CW_DEBUG_SELF + CW_DEBUG_SELF, + CW_SETUP_WINENV } cygwin_getinfo_types; #define CW_NEXTPID 0x80000000 /* or with pid to get next one */ |