From 28614e4f9f8369f570ad07e1a179b6b9bb054db5 Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 25 Jun 1999 17:28:53 +0000 Subject: [PATCH] Fixed several bugs in browsing code. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@474 7a7537e8-13f0-0310-91df-b6672ffda945 --- cgi-bin/classes.c | 32 ++++++++++++++++++-------------- cgi-bin/printers.c | 18 +++++++++++------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/cgi-bin/classes.c b/cgi-bin/classes.c index b171748a9..5e1bd8309 100644 --- a/cgi-bin/classes.c +++ b/cgi-bin/classes.c @@ -1,5 +1,5 @@ /* - * "$Id: classes.c,v 1.2 1999/06/23 14:08:35 mike Exp $" + * "$Id: classes.c,v 1.3 1999/06/25 17:28:52 mike Exp $" * * Class status CGI for the Common UNIX Printing System (CUPS). * @@ -273,7 +273,7 @@ show_class_info(http_t *http, * * attributes-charset * attributes-natural-language - * class-uri + * printer-uri */ request = ippNew(); @@ -289,7 +289,7 @@ show_class_info(http_t *http, sprintf(uri, "ipp://localhost/classes/%s", name); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "class-uri", NULL, uri); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); /* * Do the request and get back a response... @@ -312,24 +312,27 @@ show_class_info(http_t *http, * Grab the needed class attributes... */ - if ((attr = ippFindAttribute(response, "class-state", IPP_TAG_ENUM)) != NULL) + if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL) pstate = (ipp_pstate_t)attr->values[0].integer; else pstate = IPP_PRINTER_IDLE; - if ((attr = ippFindAttribute(response, "class-state-message", IPP_TAG_TEXT)) != NULL) + if ((attr = ippFindAttribute(response, "printer-state-message", IPP_TAG_TEXT)) != NULL) message = attr->values[0].string.text; else message = NULL; - if ((attr = ippFindAttribute(response, "class-is-accepting-jobs", + if ((attr = ippFindAttribute(response, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL) accepting = attr->values[0].boolean; else accepting = 1; - if ((attr = ippFindAttribute(response, "printer-uri", IPP_TAG_URI)) != NULL) - strcpy(uri, attr->values[0].string.text); + if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL) + { + strcpy(uri, "http:"); + strcpy(uri + 5, strchr(attr->values[0].string.text, '/')); + } /* * Display the class entry... @@ -337,7 +340,7 @@ show_class_info(http_t *http, puts(""); - printf("%s\n", name, name); + printf("%s\n", uri, name); puts(""); @@ -368,7 +371,7 @@ show_class_info(http_t *http, * * attributes-charset * attributes-natural-language - * class-uri + * printer-uri */ request = ippNew(); @@ -384,8 +387,9 @@ show_class_info(http_t *http, "attributes-natural-language", NULL, language->language); + sprintf(uri, "ipp://localhost/printers/%s", name); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, - "class-uri", NULL, uri); + "printer-uri", NULL, uri); jobs = cupsDoRequest(http, request, uri + 15); } @@ -398,8 +402,8 @@ show_class_info(http_t *http, if (jobs != NULL) { char *username; /* Pointer to job-originating-user-name */ - int jobid, /* job-id */ - size; /* job-k-octets */ + int jobid, /* job-id */ + size; /* job-k-octets */ for (attr = jobs->attrs; attr != NULL; attr = attr->next) @@ -467,5 +471,5 @@ show_class_info(http_t *http, /* - * End of "$Id: classes.c,v 1.2 1999/06/23 14:08:35 mike Exp $". + * End of "$Id: classes.c,v 1.3 1999/06/25 17:28:52 mike Exp $". */ diff --git a/cgi-bin/printers.c b/cgi-bin/printers.c index 6362b1a4c..62832ab45 100644 --- a/cgi-bin/printers.c +++ b/cgi-bin/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c,v 1.4 1999/06/23 14:08:36 mike Exp $" + * "$Id: printers.c,v 1.5 1999/06/25 17:28:53 mike Exp $" * * Printer status CGI for the Common UNIX Printing System (CUPS). * @@ -328,8 +328,11 @@ show_printer_info(http_t *http, else accepting = 1; - if ((attr = ippFindAttribute(response, "printer-uri", IPP_TAG_URI)) != NULL) - strcpy(uri, attr->values[0].string.text); + if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL) + { + strcpy(uri, "http:"); + strcpy(uri + 5, strchr(attr->values[0].string.text, '/')); + } /* * Display the printer entry... @@ -337,7 +340,7 @@ show_printer_info(http_t *http, puts(""); - printf("%s\n", name, name); + printf("%s\n", uri, name); printf("\n", pstate == IPP_PRINTER_IDLE ? "idle" : @@ -386,6 +389,7 @@ show_printer_info(http_t *http, "attributes-natural-language", NULL, language->language); + sprintf(uri, "ipp://localhost/printers/%s", name); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -400,8 +404,8 @@ show_printer_info(http_t *http, if (jobs != NULL) { char *username; /* Pointer to job-originating-user-name */ - int jobid, /* job-id */ - size; /* job-k-octets */ + int jobid, /* job-id */ + size; /* job-k-octets */ for (attr = jobs->attrs; attr != NULL; attr = attr->next) @@ -469,5 +473,5 @@ show_printer_info(http_t *http, /* - * End of "$Id: printers.c,v 1.4 1999/06/23 14:08:36 mike Exp $". + * End of "$Id: printers.c,v 1.5 1999/06/25 17:28:53 mike Exp $". */ -- 2.39.5