delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/05/31/00:37:16

From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Wed, 31 May 2000 00:35:05 -0400
MIME-Version: 1.0
Subject: Re: __dosexec_find_on_path question
Message-ID: <39345E39.31070.44E4CF@localhost>
In-reply-to: <200005302148.AAA10657@alpha.netvision.net.il>
References: <3933DE1E DOT 13566 DOT 25B201 AT localhost> (snowball3 AT bigfoot DOT com)
X-mailer: Pegasus Mail for Win32 (v3.12c)
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

This patch adds the extra flag and uses it in __spawnve.

*** src/libc/dos/process/dosexec.c.orig	Tue Jun 29 11:50:10 1999
--- src/libc/dos/process/dosexec.c	Tue May 30 20:05:26 2000
*************** static int script_exec(const char *progr
*** 893,910 ****
     possible extension of an executable file.  It only mentions
     those extensions that can be *omitted* when you invoke the
     executable from one of the shells used on MSDOS.  */
  static struct {
    const char *extension;
    int (*interp)(const char *, char **, char **);
  } interpreters[] = {
!   { ".com", direct_exec },
!   { ".exe", go32_exec },
!   { ".bat", __dosexec_command_exec },
!   { ".btm", __dosexec_command_exec },
!   { ".sh",  script_exec },  /* for compatibility with ms_sh */
!   { ".ksh", script_exec },
!   { ".pl", script_exec },   /* Perl */
!   { ".sed", script_exec },
    { "",     go32_exec },
    { 0,      script_exec },  /* every extension not mentioned above calls it */
    { 0,      0 },
--- 893,914 ----
     possible extension of an executable file.  It only mentions
     those extensions that can be *omitted* when you invoke the
     executable from one of the shells used on MSDOS.  */
+ 
+ #define INTERP_FLAG_SKIP_SEARCH 1
+ 
  static struct {
    const char *extension;
    int (*interp)(const char *, char **, char **);
+   unsigned char flags;
  } interpreters[] = {
!   { ".com", direct_exec, 0 },
!   { ".exe", go32_exec, 0 },
!   { ".bat", __dosexec_command_exec, 0 },
!   { ".btm", __dosexec_command_exec, 0 },
!   { ".sh",  script_exec, INTERP_FLAG_SKIP_SEARCH },  /* Bash */
!   { ".ksh", script_exec, INTERP_FLAG_SKIP_SEARCH},
!   { ".pl", script_exec, INTERP_FLAG_SKIP_SEARCH},   /* Perl */
!   { ".sed", script_exec, INTERP_FLAG_SKIP_SEARCH},
    { "",     go32_exec },
    { 0,      script_exec },  /* every extension not mentioned above calls it */
    { 0,      0 },
*************** int __spawnve(int mode, const char *path
*** 1061,1075 ****
    {
      for (i=0; interpreters[i].extension; i++)
      {
!       strcpy(rp, interpreters[i].extension);
!       if (access(rpath, F_OK) == 0 && !(is_dir = (access(rpath, D_OK) == 0)))
        {
! 	found = 1;
! 	break;
        }
      }
    }
! 
    if (!found)
    {
      const char *rpath_ext;
--- 1065,1083 ----
    {
      for (i=0; interpreters[i].extension; i++)
      {
!       if ((interpreters[i].flags & INTERP_FLAG_SKIP_SEARCH) == 0)
        {
!         strcpy(rp, interpreters[i].extension);
!         if (access(rpath, F_OK) == 0 && !(is_dir = (access(rpath, D_OK) == 0)))
!         {
! 	  found = 1;
! 	  break;
!         }
        }
      }
    }
!   *rp = 0;
!   
    if (!found)
    {
      const char *rpath_ext;


- Raw text -


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