diff options
author | Eli Zaretskii <eliz@gnu.org> | 2002-03-04 20:06:58 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2002-03-04 20:06:58 +0000 |
commit | 906e2a433d4f9ef1c0902e3d7a91a1064383a4fd (patch) | |
tree | 02fd8f00b4f8dd27687422748a1730b127f3f96f /src/sysdep.c | |
parent | 23558f401f7b840afdd07203de7cf48d2c15f5e8 (diff) | |
download | emacs-906e2a433d4f9ef1c0902e3d7a91a1064383a4fd.tar.gz |
(sys_subshell) [MSDOS]: If PWD is set in the
environment, pass it down with corrected value.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r-- | src/sysdep.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index f560e9d7cf2..ef5000eeb09 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)); |