]> cygwin.com Git - cygwin-apps/cygutils.git/commitdiff
Update cygstart for mount -X compatibility
authorCharles Wilson <cygwin@cwilson.fastmail.fm>
Mon, 16 May 2005 20:18:52 +0000 (20:18 +0000)
committerCharles Wilson <cygwin@cwilson.fastmail.fm>
Mon, 16 May 2005 20:18:52 +0000 (20:18 +0000)
ChangeLog
NEWS
src/cygstart/cygstart.c

index d5d9ecc881e59ce1e88fa70ab64c7efc286b233a..8121cdf9425759982ba57a8023dbf4187ceaecdc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-05-16  Michael Schaap  >cygstart@...>
+
+       * src/cygstart/cygstart.c: improve compatibility with
+       'mount -X' by syncing env between cygwin and windows.
+       * NEWS: update documentation
+
 2005-04-12  Charles Wilson <cwilson@...>
 
        bump version number - 1.2.7
diff --git a/NEWS b/NEWS
index eaada7a0530ff248bae5506c5c807999dda7ddd4..388822ea6893faa2f151e7aa9db4e538cfb8d2f0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+1.2.8
+  more updates to cygstart (Michael Schaap)
+
+
 1.2.7
   Updates to cygstart (Anthony Derosa, Michael Schaap)
   New 'rename' program (Christopher Faylor)
index 66622d2ad4cb24821b8c26af8709b288e1dac602..15e6eda7ea50e58108c5fcf7ae944390ea03a537 100644 (file)
@@ -40,7 +40,7 @@
 #define MSDN_URL "http://msdn.microsoft.com/library/en-us/shellcc/platform/" \
                  "Shell/reference/functions/shellexecute.asp"
 
-static const char versionID[] = "1.0";
+static const char versionID[] = "1.2";
 /* for future CVS */
 static const char revID[] =
        "$Id$";
@@ -64,6 +64,7 @@ static void usage(poptContext optCon, FILE *f, char *name);
 static void help(poptContext optCon, FILE *f, char *name);
 static void version(poptContext optCon, FILE *f, char *name);
 static void license(poptContext optCon, FILE *f, char *name);
+static void setup_win_environ(void);
 
 int main(int argc, const char **argv)
 {
@@ -404,6 +405,9 @@ static int winStart(const char *aPath, const char *action, const char *args,
 {
     int ret;
 
+    /* Need to sync the Windows environment when running under "mount -X" */
+    setup_win_environ();
+
     ret = (int) ShellExecute(NULL, action, aPath, args, workDir, show);
     if (ret >= 32) {
         return TRUE;
@@ -511,3 +515,25 @@ static void license(poptContext optCon, FILE *f, char *name)
   printTopDescription(f, name);
   printLicense(f, name);
 }  
+
+/* Copy cygwin environment variables to the Windows environment if they're not
+ * already there. */
+static void setup_win_environ(void)
+{
+    char **envp = environ;
+    char *var, *val;
+    char curval[2];
+
+    while (envp && *envp) {
+        var = strdup(*envp++);
+        val = strchr(var, '=');
+        *val++ = '\0';
+        
+        if (GetEnvironmentVariable(var, curval, 2) == 0
+                    && GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
+            SetEnvironmentVariable(var, val);
+        }
+
+        free(var);
+    }
+}
This page took 0.033284 seconds and 5 git commands to generate.