summaryrefslogtreecommitdiff
path: root/berkeley
diff options
context:
space:
mode:
authorjlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be>2006-11-07 19:32:27 +0000
committerjlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be>2006-11-07 19:32:27 +0000
commit26d47ec6888969c3a3957f55c9eed0778813b94a (patch)
treeeec718b11e7f559cd0346c78363d68f728e9e106 /berkeley
parent2abf387cae0cce4bf3a0a259ded28ef0269aec47 (diff)
downloadcups-26d47ec6888969c3a3957f55c9eed0778813b94a.tar.gz
Load cups into easysw/current.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@238 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'berkeley')
-rw-r--r--berkeley/lpc.c89
1 files changed, 20 insertions, 69 deletions
diff --git a/berkeley/lpc.c b/berkeley/lpc.c
index 96aca4b00..3c51c6a54 100644
--- a/berkeley/lpc.c
+++ b/berkeley/lpc.c
@@ -1,5 +1,5 @@
/*
- * "$Id: lpc.c 5926 2006-09-05 20:45:47Z mike $"
+ * "$Id: lpc.c 6073 2006-11-02 20:01:54Z mike $"
*
* "lpc" command for the Common UNIX Printing System (CUPS).
*
@@ -237,10 +237,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
const char *dests) /* I - Destinations */
{
ipp_t *request, /* IPP Request */
- *response, /* IPP Response */
- *jobs; /* IPP Get Jobs response */
- ipp_attribute_t *attr, /* Current attribute */
- *jattr; /* Current job attribute */
+ *response; /* IPP Response */
+ ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language; /* Default language */
char *printer, /* Printer name */
*device, /* Device URI */
@@ -251,14 +249,13 @@ show_status(http_t *http, /* I - HTTP connection to server */
const char *dptr, /* Pointer into destination list */
*ptr; /* Pointer into printer name */
int match; /* Non-zero if this job matches */
- char printer_uri[HTTP_MAX_URI];
- /* Printer URI */
static const char *requested[] = /* Requested attributes */
{
- "printer-name",
"device-uri",
+ "printer-is-accepting-jobs",
+ "printer-name",
"printer-state",
- "printer-is-accepting-jobs"
+ "queued-job-count"
};
@@ -329,21 +326,21 @@ show_status(http_t *http, /* I - HTTP connection to server */
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
{
- if (!strcmp(attr->name, "printer-name") &&
- attr->value_tag == IPP_TAG_NAME)
- printer = attr->values[0].string.text;
-
if (!strcmp(attr->name, "device-uri") &&
attr->value_tag == IPP_TAG_URI)
device = attr->values[0].string.text;
-
- if (!strcmp(attr->name, "printer-state") &&
- attr->value_tag == IPP_TAG_ENUM)
- pstate = (ipp_pstate_t)attr->values[0].integer;
-
- if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
- attr->value_tag == IPP_TAG_BOOLEAN)
+ else if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
+ attr->value_tag == IPP_TAG_BOOLEAN)
accepting = attr->values[0].boolean;
+ else if (!strcmp(attr->name, "printer-name") &&
+ attr->value_tag == IPP_TAG_NAME)
+ printer = attr->values[0].string.text;
+ else if (!strcmp(attr->name, "printer-state") &&
+ attr->value_tag == IPP_TAG_ENUM)
+ pstate = (ipp_pstate_t)attr->values[0].integer;
+ else if (!strcmp(attr->name, "queued-job-count") &&
+ attr->value_tag == IPP_TAG_INTEGER)
+ jobcount = attr->values[0].integer;
attr = attr->next;
}
@@ -395,7 +392,8 @@ show_status(http_t *http, /* I - HTTP connection to server */
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
ptr ++, dptr ++);
- if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr & 255)))
+ if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
+ isspace(*dptr & 255)))
{
match = 1;
break;
@@ -422,53 +420,6 @@ show_status(http_t *http, /* I - HTTP connection to server */
if (match)
{
/*
- * Build an IPP_GET_JOBS request, which requires the following
- * attributes:
- *
- * attributes-charset
- * attributes-natural-language
- * printer-uri
- * limit
- */
-
- request = ippNew();
-
- request->request.op.operation_id = IPP_GET_JOBS;
- request->request.op.request_id = 1;
-
- language = cupsLangDefault();
-
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL,
- cupsLangEncoding(language));
-
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
- "attributes-natural-language", NULL,
- language->language);
-
- httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
- "ipp", NULL, "localhost", 631, "/printers/%s",
- printer);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
- "printer-uri", NULL, printer_uri);
-
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
- "requested-attributes", NULL, "job-id");
-
- if ((jobs = cupsDoRequest(http, request, "/")) != NULL)
- {
- /*
- * Grab the number of jobs for the printer.
- */
-
- for (jattr = jobs->attrs; jattr != NULL; jattr = jattr->next)
- if (jattr->name && !strcmp(jattr->name, "job-id"))
- jobcount ++;
-
- ippDelete(jobs);
- }
-
- /*
* Display it...
*/
@@ -520,5 +471,5 @@ show_status(http_t *http, /* I - HTTP connection to server */
/*
- * End of "$Id: lpc.c 5926 2006-09-05 20:45:47Z mike $".
+ * End of "$Id: lpc.c 6073 2006-11-02 20:01:54Z mike $".
*/