summaryrefslogtreecommitdiff
path: root/cups/dest.c
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-06-20 13:08:15 -0400
committerMichael Sweet <michael.r.sweet@gmail.com>2017-06-20 13:08:15 -0400
commit90c67342b60cf53b05e337376465841e7e7cd6a6 (patch)
tree5e6c7d33c61e498f181e139b031692df7c0357b8 /cups/dest.c
parent956bb1274c77ec9b8fe84f2f1099d51de002e078 (diff)
Add CUPS_DEST_FLAGS_DEVICE flag for cupsConnectDest.
Diffstat (limited to 'cups/dest.c')
-rw-r--r--cups/dest.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/cups/dest.c b/cups/dest.c
index 3ff285d8c..5cc5c3d94 100644
--- a/cups/dest.c
+++ b/cups/dest.c
@@ -579,6 +579,11 @@ _cupsAppleSetUseLastPrinter(
* returns 0. The caller is responsible for calling @link httpClose@ on the
* returned connection.
*
+ * Starting with CUPS 2.2.4, the caller can pass @code CUPS_DEST_FLAGS_DEVICE@
+ * for the "flags" argument to connect directly to the device associated with
+ * the destination. Otherwise, the connection is made to the CUPS scheduler
+ * associated with the destination.
+ *
* @since CUPS 1.6/macOS 10.8@
*/
@@ -630,7 +635,20 @@ cupsConnectDest(
* Grab the printer URI...
*/
- if ((uri = cupsGetOption("printer-uri-supported", dest->num_options, dest->options)) == NULL)
+ if (flags & CUPS_DEST_FLAGS_DEVICE)
+ {
+ if ((uri = cupsGetOption("resolved-device-uri", dest->num_options, dest->options)) == NULL)
+ {
+ if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL)
+ {
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+ if (strstr(uri, "._tcp"))
+ uri = cups_dnssd_resolve(dest, uri, msec, cancel, cb, user_data);
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
+ }
+ }
+ }
+ else if ((uri = cupsGetOption("printer-uri-supported", dest->num_options, dest->options)) == NULL)
{
if ((uri = cupsGetOption("resolved-device-uri", dest->num_options, dest->options)) == NULL)
{
@@ -755,6 +773,11 @@ cupsConnectDest(
* pointed to by "cancel" is non-zero, or the block returns 0. The caller is
* responsible for calling @link httpClose@ on the returned connection.
*
+ * Starting with CUPS 2.2.4, the caller can pass @code CUPS_DEST_FLAGS_DEVICE@
+ * for the "flags" argument to connect directly to the device associated with
+ * the destination. Otherwise, the connection is made to the CUPS scheduler
+ * associated with the destination.
+ *
* @since CUPS 1.6/macOS 10.8@ @exclude all@
*/