Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-02-02 22:55:45 +0300
committerChristopher Faylor <me@cgf.cx>2006-02-02 22:55:45 +0300
commit6577c186c972ad4b75e4854c8c261f6cf34bf5cc (patch)
tree29065d8de0a96af66433bb3c5cd9896d8f2cbc39 /winsup/cygwin/external.cc
parentbb6f800d1840dfb870fa5af01c5884317330bdf6 (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/cygwin/external.cc')
-rw-r--r--winsup/cygwin/external.cc24
1 files changed, 24 insertions, 0 deletions
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;
}