version 1.80, 2007/09/18 08:27:22 |
version 1.81, 2007/09/23 09:39:18 |
|
|
#define ABORT_INTERRUPT 2 /* Because it was interrupted */ |
#define ABORT_INTERRUPT 2 /* Because it was interrupted */ |
#define ABORT_WAIT 3 /* Waiting for jobs to finish */ |
#define ABORT_WAIT 3 /* Waiting for jobs to finish */ |
|
|
/* |
|
* XXX: Avoid SunOS bug... FILENO() is fp->_file, and file |
|
* is a char! So when we go above 127 we turn negative! |
|
*/ |
|
#define FILENO(a) ((unsigned) fileno(a)) |
|
|
|
static int numCommands; /* The number of commands actually printed |
static int numCommands; /* The number of commands actually printed |
* for a target. Should this number be |
* for a target. Should this number be |
* 0, no shell will be executed. */ |
* 0, no shell will be executed. */ |
|
|
* marked close-on-exec, we must clear that bit in the new |
* marked close-on-exec, we must clear that bit in the new |
* input. |
* input. |
*/ |
*/ |
if (dup2(FILENO(job->cmdFILE), 0) == -1) |
if (dup2(fileno(job->cmdFILE), 0) == -1) |
Punt("Cannot dup2: %s", strerror(errno)); |
Punt("Cannot dup2: %s", strerror(errno)); |
(void)fcntl(0, F_SETFD, 0); |
(void)fcntl(0, F_SETFD, 0); |
(void)lseek(0, 0, SEEK_SET); |
(void)lseek(0, 0, SEEK_SET); |
|
|
if (job->cmdFILE == NULL) { |
if (job->cmdFILE == NULL) { |
Punt("Could not open %s", tfile); |
Punt("Could not open %s", tfile); |
} |
} |
(void)fcntl(FILENO(job->cmdFILE), F_SETFD, 1); |
(void)fcntl(fileno(job->cmdFILE), F_SETFD, 1); |
/* |
/* |
* Send the commands to the command file, flush all its buffers |
* Send the commands to the command file, flush all its buffers |
* then rewind and remove the thing. |
* then rewind and remove the thing. |