Mail Archives: djgpp-workers/2000/05/31/00:37:16
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 -