version 1.104, 2007/11/03 10:41:48 |
version 1.105, 2007/11/03 11:44:30 |
|
|
static void debug_printf(const char *, ...); |
static void debug_printf(const char *, ...); |
static Job *prepare_job(GNode *, int); |
static Job *prepare_job(GNode *, int); |
static void start_queued_job(Job *); |
static void start_queued_job(Job *); |
static void token(Job *, FILE *); |
static void banner(Job *, FILE *); |
static void print_partial_buffer(struct job_pipe *, Job *, FILE *, size_t); |
static void print_partial_buffer(struct job_pipe *, Job *, FILE *, size_t); |
static void print_partial_buffer_and_shift(struct job_pipe *, Job *, FILE *, |
static void print_partial_buffer_and_shift(struct job_pipe *, Job *, FILE *, |
size_t); |
size_t); |
|
|
} |
} |
|
|
static void |
static void |
token(Job *job, FILE *out) |
banner(Job *job, FILE *out) |
{ |
{ |
if (job->node != lastNode) { |
if (job->node != lastNode) { |
if (DEBUG(JOBTOKEN)) |
if (DEBUG(JOBBANNER)) |
(void)fprintf(out, "--- %s ---\n", job->node->name); |
(void)fprintf(out, "--- %s ---\n", job->node->name); |
lastNode = job->node; |
lastNode = job->node; |
} |
} |
|
|
if (WIFEXITED(status)) { |
if (WIFEXITED(status)) { |
debug_printf("Process %ld exited.\n", (long)job->pid); |
debug_printf("Process %ld exited.\n", (long)job->pid); |
if (WEXITSTATUS(status) != 0) { |
if (WEXITSTATUS(status) != 0) { |
token(job, stdout); |
banner(job, stdout); |
(void)fprintf(stdout, "*** Error code %d%s\n", |
(void)fprintf(stdout, "*** Error code %d%s\n", |
WEXITSTATUS(status), |
WEXITSTATUS(status), |
(job->flags & JOB_IGNERR) ? "(ignored)" : |
(job->flags & JOB_IGNERR) ? "(ignored)" : |
|
|
status = 0; |
status = 0; |
} |
} |
} else if (DEBUG(JOB)) { |
} else if (DEBUG(JOB)) { |
token(job, stdout); |
banner(job, stdout); |
(void)fprintf(stdout, |
(void)fprintf(stdout, |
"*** Completed successfully\n"); |
"*** Completed successfully\n"); |
} |
} |
} else if (WIFSTOPPED(status)) { |
} else if (WIFSTOPPED(status)) { |
debug_printf("Process %ld stopped.\n", (long)job->pid); |
debug_printf("Process %ld stopped.\n", (long)job->pid); |
token(job, stdout); |
banner(job, stdout); |
(void)fprintf(stdout, "*** Stopped -- signal %d\n", |
(void)fprintf(stdout, "*** Stopped -- signal %d\n", |
WSTOPSIG(status)); |
WSTOPSIG(status)); |
job->flags |= JOB_RESUME; |
job->flags |= JOB_RESUME; |
|
|
* child. |
* child. |
*/ |
*/ |
if (job->flags & (JOB_RESUME|JOB_RESTART)) { |
if (job->flags & (JOB_RESUME|JOB_RESTART)) { |
token(job, stdout); |
banner(job, stdout); |
(void)fprintf(stdout, "*** Continued\n"); |
(void)fprintf(stdout, "*** Continued\n"); |
} |
} |
if (!(job->flags & JOB_CONTINUING)) { |
if (!(job->flags & JOB_CONTINUING)) { |
|
|
(void)fflush(stdout); |
(void)fflush(stdout); |
return; |
return; |
} else { |
} else { |
token(job, stdout); |
banner(job, stdout); |
(void)fprintf(stdout, "*** Signal %d\n", |
(void)fprintf(stdout, "*** Signal %d\n", |
WTERMSIG(status)); |
WTERMSIG(status)); |
} |
} |
|
|
* banner with their name in it never appears). This is an attempt to |
* banner with their name in it never appears). This is an attempt to |
* provide that feedback, even if nothing follows it. |
* provide that feedback, even if nothing follows it. |
*/ |
*/ |
token(job, stdout); |
banner(job, stdout); |
|
|
setup_engine(); |
setup_engine(); |
|
|
|
|
/* Helper functions for JobDoOutput */ |
/* Helper functions for JobDoOutput */ |
|
|
|
|
/* output debugging token and print characters from 0 to endpos */ |
/* output debugging banner and print characters from 0 to endpos */ |
static void |
static void |
print_partial_buffer(struct job_pipe *p, Job *job, FILE *out, size_t endPos) |
print_partial_buffer(struct job_pipe *p, Job *job, FILE *out, size_t endPos) |
{ |
{ |
size_t i; |
size_t i; |
|
|
token(job, out); |
banner(job, out); |
for (i = 0; i < endPos; i++) |
for (i = 0; i < endPos; i++) |
putc(p->buffer[i], out); |
putc(p->buffer[i], out); |
} |
} |