#define BASH_XTRACEFD ENABLE_ASH_BASH_COMPAT
#define BASH_READ_D ENABLE_ASH_BASH_COMPAT
#define IF_BASH_READ_D IF_ASH_BASH_COMPAT
+#define BASH_WAIT_N ENABLE_ASH_BASH_COMPAT
#if defined(__ANDROID_API__) && __ANDROID_API__ <= 24
/* Bionic at least up to version 24 has no glob() */
#define DOWAIT_NONBLOCK 0
#define DOWAIT_BLOCK 1
#define DOWAIT_BLOCK_OR_SIG 2
-#if ENABLE_ASH_BASH_COMPAT
+#if BASH_WAIT_N
# define DOWAIT_JOBSTATUS 0x10 /* OR this to get job's exitstatus instead of pid */
#endif
int status;
struct job *jp;
struct job *thisjob;
-#if ENABLE_ASH_BASH_COMPAT
+#if BASH_WAIT_N
bool want_jobexitstatus = (block & DOWAIT_JOBSTATUS);
block = (block & ~DOWAIT_JOBSTATUS);
#endif
out:
INT_ON;
-#if ENABLE_ASH_BASH_COMPAT
+#if BASH_WAIT_N
if (want_jobexitstatus) {
pid = -1;
if (thisjob && thisjob->state == JOBDONE)
struct job *job;
int retval;
struct job *jp;
-#if ENABLE_ASH_BASH_COMPAT
+#if BASH_WAIT_N
int status;
char one = nextopt("n");
#else
/* wait for all jobs / one job if -n */
for (;;) {
jp = curjob;
-#if ENABLE_ASH_BASH_COMPAT
+#if BASH_WAIT_N
if (one && !jp)
/* exitcode of "wait -n" with nothing to wait for is 127, not 0 */
retval = 127;
* with an exit status greater than 128, immediately after which
* the trap is executed."
*/
-#if ENABLE_ASH_BASH_COMPAT
+#if BASH_WAIT_N
status = dowait(DOWAIT_BLOCK_OR_SIG | DOWAIT_JOBSTATUS, NULL);
#else
dowait(DOWAIT_BLOCK_OR_SIG, NULL);
*/
if (pending_sig)
goto sigout;
-#if ENABLE_ASH_BASH_COMPAT
+#if BASH_WAIT_N
if (one) {
/* wait -n waits for one _job_, not one _process_.
* date; sleep 3 & sleep 2 | sleep 1 & wait -n; date