*
* CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* Show status...
*/
- cgiStartMultipart();
- cgiStartHTML(title);
- cgiCopyTemplateLang("command.tmpl");
- cgiEndHTML();
- fflush(stdout);
+ if (cgiSupportsMultipart())
+ {
+ cgiStartMultipart();
+ cgiStartHTML(title);
+ cgiCopyTemplateLang("command.tmpl");
+ cgiEndHTML();
+ fflush(stdout);
+ }
/*
* Send the command file job...
cgiStartHTML(title);
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
- cgiEndMultipart();
+
+ if (cgiSupportsMultipart())
+ cgiEndMultipart();
return;
}
cgiStartHTML(title);
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
- cgiEndMultipart();
+
+ if (cgiSupportsMultipart())
+ cgiEndMultipart();
cupsCancelJob(dest, job_id);
return;
* Wait for the job to complete...
*/
- for (;;)
+ if (cgiSupportsMultipart())
{
- /*
- * Get the current job state...
- */
+ for (;;)
+ {
+ /*
+ * Get the current job state...
+ */
- snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
- request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
- NULL, uri);
- if (user)
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
- "requesting-user-name", NULL, user);
- ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
- "requested-attributes", 2, NULL, job_attrs);
+ snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id);
+ request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
+ NULL, uri);
+ if (user)
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+ "requesting-user-name", NULL, user);
+ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "requested-attributes", 2, NULL, job_attrs);
- if ((response = cupsDoRequest(http, request, "/")) != NULL)
- cgiSetIPPVars(response, NULL, NULL, NULL, 0);
+ if ((response = cupsDoRequest(http, request, "/")) != NULL)
+ cgiSetIPPVars(response, NULL, NULL, NULL, 0);
- attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
- if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED)
- {
- ippDelete(response);
- break;
- }
+ attr = ippFindAttribute(response, "job-state", IPP_TAG_ENUM);
+ if (!attr || attr->values[0].integer >= IPP_JOB_STOPPED)
+ {
+ ippDelete(response);
+ break;
+ }
- /*
- * Job not complete, so update the status...
- */
+ /*
+ * Job not complete, so update the status...
+ */
- ippDelete(response);
+ ippDelete(response);
- cgiStartHTML(title);
- cgiCopyTemplateLang("command.tmpl");
- cgiEndHTML();
- fflush(stdout);
+ cgiStartHTML(title);
+ cgiCopyTemplateLang("command.tmpl");
+ cgiEndHTML();
+ fflush(stdout);
- sleep(5);
+ sleep(5);
+ }
}
/*
cgiStartHTML(title);
cgiCopyTemplateLang("command.tmpl");
cgiEndHTML();
- cgiEndMultipart();
+
+ if (cgiSupportsMultipart())
+ cgiEndMultipart();
}