changeset 43706:009de2eaf047

(sys_subshell) [MSDOS]: If PWD is set in the environment, pass it down with corrected value.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 04 Mar 2002 20:06:58 +0000
parents 223fa5122806
children 8958bd4ddd09
files src/sysdep.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Mon Mar 04 17:23:22 2002 +0000
+++ b/src/sysdep.c	Mon Mar 04 20:06:58 2002 +0000
@@ -850,8 +850,22 @@
 #endif
 
 #ifdef MSDOS    /* Demacs 1.1.2 91/10/20 Manabu Higashida */
-      st = system (sh);
-      chdir (oldwd);
+      {
+	char *old_pwd = getenv ("PWD");
+
+	/* If PWD is set, pass it with corrected value.  */
+	if (old_pwd)
+	  {
+	    old_pwd = xstrdup (old_pwd);
+	    if (str[len - 1] == '/')
+	      str[len - 1] = '\0';
+	    setenv ("PWD", str, 1);
+	  }
+	st = system (sh);
+	chdir (oldwd);
+	if (old_pwd)
+	  putenv (old_pwd);	/* restore previous value */
+      }
 #if 0	/* This is also reported if last command executed in subshell failed, KFS */
       if (st)
 	report_file_error ("Can't execute subshell", Fcons (build_string (sh), Qnil));