From c0917202cfe848f747188f0b2cebfe04fcce6aa3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 4 Mar 2002 20:08:37 +0000 Subject: [PATCH] (sys_subshell) [MSDOS]: If PWD is set in the environment, pass it down with corrected value. --- src/ChangeLog | 5 +++++ src/sysdep.c | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fb15705c697..fe39168e5b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-03-04 Eli Zaretskii + + * 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 * lread.c (read_filtered_event): Do not call start_hourglass 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)); -- 2.39.2