+2000-07-26 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * pexecute.c (pexecute) [__MSDOS__]: Change __GO32__ to
+ __DJGPP__. Use P_WAIT instead of constant in the spawnv* call.
+ Cast program to 'char *' in errmsg_arg assignment.
+ (PWAIT_ERROR): Define.
+ (pwait): Use PWAIT_ERROR. Adjust DJGPP's status code to conform
+ to DJGPP's WIF* macros.
+
2000-07-27 RodneyBrown <RodneyBrown@pmsc.com>
Jeff Law <law@cygnus.com>
if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
abort ();
-#ifdef __GO32__
+#ifdef __DJGPP__
/* ??? What are the possible return values from spawnv? */
- rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
+ rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
#else
char *scmd, *rf;
FILE *argfile;
if (rc == -1)
{
*errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
+ *errmsg_arg = (char *)program;
return -1;
}
return last_pid;
}
+/* Use ECHILD if available, otherwise use EINVAL. */
+#ifdef ECHILD
+#define PWAIT_ERROR ECHILD
+#else
+#define PWAIT_ERROR EINVAL
+#endif
+
int
pwait (pid, status, flags)
int pid;
/* Called twice for the same child? */
|| pid == last_reaped)
{
- /* ??? ECHILD would be a better choice. Can we use it here? */
- errno = EINVAL;
+ errno = PWAIT_ERROR;
return -1;
}
/* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */
+#ifdef __DJGPP__
+ *status = (last_status >> 8);
+#else
*status = last_status;
+#endif
last_reaped = last_pid;
return last_pid;
}