aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2002-03-04 20:08:37 +0000
committerEli Zaretskii <[email protected]>2002-03-04 20:08:37 +0000
commitc0917202cfe848f747188f0b2cebfe04fcce6aa3 (patch)
tree8442c262bd73101853ed66b1d909b18e8c464908 /src
parent54679108362b1247d63c1bb193d8e4d759daf134 (diff)
(sys_subshell) [MSDOS]: If PWD is set in the
environment, pass it down with corrected value.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/sysdep.c18
2 files changed, 21 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fb15705c69..fe39168e5b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-04 Eli Zaretskii <[email protected]>
+
+ * sysdep.c (sys_subshell) [MSDOS]: If PWD is set in the
+ environment, pass it down with corrected value.
+
2002-03-04 Pavel Jan,Bm(Bk <[email protected]>
* lread.c (read_filtered_event): Do not call start_hourglass
diff --git a/src/sysdep.c b/src/sysdep.c
index f560e9d7cf..ef5000eeb0 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -850,8 +850,22 @@ sys_subshell ()
#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));