/*
- * "$Id: job.c 5719 2006-07-11 21:04:48Z mike $"
+ * "$Id: job.c 5889 2006-08-24 21:44:35Z mike $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
*/
cupsdLogMessage(CUPSD_LOG_WARN,
- "Printer/class %s has gone away; cancelling job %d!",
+ "Printer/class %s has gone away; canceling job %d!",
job->dest, job->id);
cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
cupsdHoldSignals();
- cupsdStopAllJobs();
+ cupsdStopAllJobs(1);
cupsdSaveAllJobs();
for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
*/
void
-cupsdStopAllJobs(void)
+cupsdStopAllJobs(int force) /* I - 1 = Force all filters to stop */
{
cupsd_job_t *job; /* Current job */
job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
if (job->state_value == IPP_JOB_PROCESSING)
{
- cupsdStopJob(job, 1);
+ cupsdStopJob(job, force);
job->state->values[0].integer = IPP_JOB_PENDING;
job->state_value = IPP_JOB_PENDING;
}
break;
}
- if (ptr == NULL)
+ if (ptr == NULL && !job->status_buffer->bufused)
{
/*
* See if all of the filters and the backend have returned their
}
else if (!strcasecmp(line, "State"))
{
- job->state_value = atoi(value);
+ job->state_value = (ipp_jstate_t)atoi(value);
if (job->state_value < IPP_JOB_PENDING)
job->state_value = IPP_JOB_PENDING;
/* PRINTER env variable */
rip_max_cache[255];
/* RIP_MAX_CACHE env variable */
- int remote_job; /* Remote print job? */
static char *options = NULL;/* Full list of options */
static int optlength = 0; /* Length of option buffer */
if (job->num_files == 0)
{
- cupsdLogMessage(CUPSD_LOG_ERROR, "Job ID %d has no files! Cancelling it!",
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Job ID %d has no files! Canceling it!",
job->id);
cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
FilterLevel += job->cost;
- /*
- * Determine if we are printing to a remote printer...
- */
-
- remote_job = printer->raw && job->num_files > 1 &&
- !strncmp(printer->device_uri, "ipp://", 6);
-
/*
* Add decompression filters, if any...
*/
- if (!remote_job && job->compressions[job->current_file])
+ if (!printer->raw && job->compressions[job->current_file])
{
/*
* Add gziptoany filter to the front of the list...
* For remote jobs, we send all of the files in the argument list.
*/
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
argv = calloc(7 + job->num_files, sizeof(char *));
else
argv = calloc(8, sizeof(char *));
argv[4] = copies;
argv[5] = options;
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
{
for (i = 0; i < job->num_files; i ++)
{
envp[envc ++] = device_uri;
envp[envc ++] = printer_name;
- if ((filter = (mime_filter_t *)cupsArrayLast(filters)) != NULL)
+ if (!printer->remote &&
+ (filter = (mime_filter_t *)cupsArrayLast(filters)) != NULL)
{
snprintf(final_content_type, sizeof(final_content_type),
"FINAL_CONTENT_TYPE=%s/%s",
- filter->src->super, filter->src->type);
+ filter->dst->super, filter->dst->type);
envp[envc ++] = final_content_type;
}
cupsdLogMessage(CUPSD_LOG_DEBUG, "[Job %d] envp[%d]=\"DEVICE_URI=%s\"",
job->id, i, sani_uri);
- if (remote_job)
+ if (printer->remote)
job->current_file = job->num_files;
else
job->current_file ++;
slot, filterfds[slot][0], filterfds[slot][1]);
cupsdClosePipe(filterfds[slot]);
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
{
for (i = 0; i < job->num_files; i ++)
free(argv[i + 6]);
cupsArrayDelete(filters);
- if (remote_job)
+ if (printer->remote && job->num_files > 1)
{
for (i = 0; i < job->num_files; i ++)
free(argv[i + 6]);
/*
- * End of "$Id: job.c 5719 2006-07-11 21:04:48Z mike $".
+ * End of "$Id: job.c 5889 2006-08-24 21:44:35Z mike $".
*/