]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/getdevices.c
Merge changes from CUPS 1.4svn-r7817.
[thirdparty/cups.git] / cups / getdevices.c
index d0e1cf2fa6061fc12c34f310a440484b20d5559b..c6f7ddac3e0af5c37985584cfae6018b3c59fec1 100644 (file)
@@ -15,6 +15,7 @@
  *
  * Contents:
  *
+ *   cupsGetDevices() - Get available printer devices.
  */
 
 /*
@@ -50,6 +51,7 @@ cupsGetDevices(
   const char   *device_class,          /* device-class value */
                *device_id,             /* device-id value */
                *device_info,           /* device-info value */
+               *device_location,       /* device-location value */
                *device_make_and_model, /* device-make-and-model value */
                *device_uri;            /* device-uri value */
   int          blocking;               /* Current blocking-IO mode */
@@ -160,6 +162,7 @@ cupsGetDevices(
   device_class          = NULL;
   device_id             = NULL;
   device_info           = NULL;
+  device_location       = "";
   device_make_and_model = NULL;
   device_uri            = NULL;
   attr                  = NULL;
@@ -192,11 +195,13 @@ cupsGetDevices(
         if (device_class && device_id && device_info && device_make_and_model &&
            device_uri)
           (*callback)(device_class, device_id, device_info,
-                     device_make_and_model, device_uri, user_data);
+                     device_make_and_model, device_uri, device_location,
+                     user_data);
 
        device_class          = NULL;
        device_id             = NULL;
        device_info           = NULL;
+       device_location       = "";
        device_make_and_model = NULL;
        device_uri            = NULL;
       }
@@ -209,6 +214,9 @@ cupsGetDevices(
       else if (!strcmp(attr->name, "device-info") &&
                attr->value_tag == IPP_TAG_TEXT)
         device_info = attr->values[0].string.text;
+      else if (!strcmp(attr->name, "device-location") &&
+               attr->value_tag == IPP_TAG_TEXT)
+        device_location = attr->values[0].string.text;
       else if (!strcmp(attr->name, "device-make-and-model") &&
                attr->value_tag == IPP_TAG_TEXT)
         device_make_and_model = attr->values[0].string.text;
@@ -225,7 +233,7 @@ cupsGetDevices(
   if (device_class && device_id && device_info && device_make_and_model &&
       device_uri)
     (*callback)(device_class, device_id, device_info,
-               device_make_and_model, device_uri, user_data);
+               device_make_and_model, device_uri, device_location, user_data);
 
  /*
   * Set the IPP status and return...
@@ -235,7 +243,7 @@ cupsGetDevices(
   httpFlush(http);
 
   if (status == IPP_ERROR)
-    _cupsSetError(IPP_ERROR, NULL);
+    _cupsSetError(IPP_ERROR, NULL, 0);
   else
   {
     attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
@@ -245,8 +253,8 @@ cupsGetDevices(
                  attr ? attr->values[0].string.text : ""));
 
     _cupsSetError(response->request.status.status_code,
-                  attr ? attr->values[0].string.text :
-                      ippErrorString(response->request.status.status_code));
+                 attr ? attr->values[0].string.text :
+                     ippErrorString(response->request.status.status_code), 0);
   }
 
   ippDelete(response);