www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/03/29/11:21:45

Date: Thu, 29 Mar 2001 18:19:17 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Mark E." <snowball3 AT bigfoot DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: (fwd) Msdos choice.com in bash204 shell returns 0
In-Reply-To: <vlh5ctcrtsts0rf90h4u5lp3sih1s265i0@4ax.com>
Message-ID: <Pine.SUN.3.91.1010329181730.6535O-100000@is>
MIME-Version: 1.0
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

On Thu, 29 Mar 2001, Mark E. wrote:

> I can confirm the return code is 0 when LFN=Y and is as expected when LFN=N. I traced
> the code path taken in dosexec.c when LFN=N and LFN=Y. When LFN=N, choice.com is
> executed via direct_exec and when LFN=Y, choice.com is executed via go32_exec. And
> when executed via go32_exec, it's changed to "%COMSPEC%/command.com /c choice.com".
> And I assume the return value is eaten by command.com.

Does the change below solve the problem?

Index: djgpp/src/libc/dos/process/dosexec.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/process/dosexec.c,v
retrieving revision 1.12
diff -u -p -r1.12 dosexec.c
--- dosexec.c	2001/02/10 20:44:52	1.12
+++ dosexec.c	2001/03/29 16:19:44
@@ -778,7 +778,10 @@ static int go32_exec(const char *program
   /* Non-DJGPP programs cannot be run by !proxy.  */
   else if (!is_coff)
   {
-    if (type->exec_format == _V2_EXEC_FORMAT_EXE)
+    const char *ext = strrchr(real_program, '.');
+
+    if (type->exec_format == _V2_EXEC_FORMAT_EXE
+	|| (ext && stricmp(ext, ".com") == 0))
     {
       if (type->object_format != _V2_OBJECT_FORMAT_PE_COFF)
 	return direct_exec(real_program, argv, envp);
@@ -1241,7 +1244,7 @@ __dosexec_find_on_path(const char *progr
       {
 	/* If some of the `access' calls failed, `errno' will hold
 	   the reason for the failure which is irrelevant to the
-	   caller (we *did* find the execuatble).  Restore the value
+	   caller (we *did* find the executable).  Restore the value
 	   `errno' had when we were called.  */
 	errno = e;
 	return buf;

- Raw text -


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