From 906e2a433d4f9ef1c0902e3d7a91a1064383a4fd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 4 Mar 2002 20:06:58 +0000 Subject: (sys_subshell) [MSDOS]: If PWD is set in the environment, pass it down with corrected value. --- src/sysdep.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/sysdep.c') 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)); -- cgit v1.2.1