delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/03/04/15:16:15

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Date: Mon, 04 Mar 2002 22:13:45 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp-workers AT delorie DOT com
Message-Id: <1438-Mon04Mar2002221344+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9
In-reply-to: <200203040830.JAA19969@lws256.lu.erisoft.se> (message from Martin
Stromberg on Mon, 4 Mar 2002 09:30:16 +0100 (MET))
Subject: Re: bash seems a little confused
References: <200203040830 DOT JAA19969 AT lws256 DOT lu DOT erisoft DOT se>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Martin Stromberg <Martin DOT Stromberg AT epl DOT ericsson DOT se>
> Date: Mon, 4 Mar 2002 09:30:16 +0100 (MET)
> > 
> > Would you like a source-level patch to try to fix this?
> 
> Yes, please.

Here:

--- src/sysdep.c.old	Fri Feb  8 12:02:44 2002
+++ src/sysdep.c	Mon Mar  4 22:11:10 2002
@@ -850,8 +850,23 @@ sys_subshell ()
 #endif
 
 #ifdef MSDOS    /* Demacs 1.1.2 91/10/20 Manabu Higashida */
-      st = system (sh);
-      chdir (oldwd);
+      {
+	char *epwd = getenv ("PWD");
+	char old_pwd[MAXPATHLEN+1+4];
+
+	/* If PWD is set, pass it with corrected value.  */
+	if (epwd)
+	  {
+	    strcpy (old_pwd, epwd);
+	    if (str[len - 1] == '/')
+	      str[len - 1] = '\0';
+	    setenv ("PWD", str, 1);
+	  }
+	st = system (sh);
+	chdir (oldwd);
+	if (epwd)
+	  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));

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019