|
Tim Waugh |
6d04fd |
diff -up cups-1.6.4/cups/dest.c.str4332 cups-1.6.4/cups/dest.c
|
|
Tim Waugh |
6d04fd |
--- cups-1.6.4/cups/dest.c.str4332 2014-03-11 15:41:45.903450653 +0000
|
|
Tim Waugh |
6d04fd |
+++ cups-1.6.4/cups/dest.c 2014-03-11 15:42:36.019765361 +0000
|
|
Tim Waugh |
6d04fd |
@@ -889,6 +889,10 @@ cupsEnumDests(
|
|
Tim Waugh |
6d04fd |
num_dests; /* Number of destinations */
|
|
Tim Waugh |
6d04fd |
cups_dest_t *dests = NULL, /* Destinations */
|
|
Tim Waugh |
6d04fd |
*dest; /* Current destination */
|
|
Tim Waugh |
6d04fd |
+ const char *defprinter; /* Default printer */
|
|
Tim Waugh |
6d04fd |
+ char name[1024], /* Copy of printer name */
|
|
Tim Waugh |
6d04fd |
+ *instance, /* Pointer to instance name */
|
|
Tim Waugh |
6d04fd |
+ *user_default; /* User default printer */
|
|
Tim Waugh |
6d04fd |
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
|
Tim Waugh |
6d04fd |
int count, /* Number of queries started */
|
|
Tim Waugh |
6d04fd |
remaining; /* Remainder of timeout */
|
|
Tim Waugh |
6d04fd |
@@ -934,6 +938,31 @@ cupsEnumDests(
|
|
Tim Waugh |
6d04fd |
num_dests = _cupsGetDests(CUPS_HTTP_DEFAULT, CUPS_GET_PRINTERS, NULL, &dests,
|
|
Tim Waugh |
6d04fd |
type, mask);
|
|
Tim Waugh |
6d04fd |
|
|
Tim Waugh |
6d04fd |
+ if ((user_default = _cupsUserDefault(name, sizeof(name))) != NULL)
|
|
Tim Waugh |
6d04fd |
+ defprinter = name;
|
|
Tim Waugh |
6d04fd |
+ else if ((defprinter = cupsGetDefault2(CUPS_HTTP_DEFAULT)) != NULL)
|
|
Tim Waugh |
6d04fd |
+ {
|
|
Tim Waugh |
6d04fd |
+ strlcpy(name, defprinter, sizeof(name));
|
|
Tim Waugh |
6d04fd |
+ defprinter = name;
|
|
Tim Waugh |
6d04fd |
+ }
|
|
Tim Waugh |
6d04fd |
+
|
|
Tim Waugh |
6d04fd |
+ if (defprinter)
|
|
Tim Waugh |
6d04fd |
+ {
|
|
Tim Waugh |
6d04fd |
+ /*
|
|
Tim Waugh |
6d04fd |
+ * Separate printer and instance name...
|
|
Tim Waugh |
6d04fd |
+ */
|
|
Tim Waugh |
6d04fd |
+
|
|
Tim Waugh |
6d04fd |
+ if ((instance = strchr(name, '/')) != NULL)
|
|
Tim Waugh |
6d04fd |
+ *instance++ = '\0';
|
|
Tim Waugh |
6d04fd |
+
|
|
Tim Waugh |
6d04fd |
+ /*
|
|
Tim Waugh |
6d04fd |
+ * Lookup the printer and instance and make it the default...
|
|
Tim Waugh |
6d04fd |
+ */
|
|
Tim Waugh |
6d04fd |
+
|
|
Tim Waugh |
6d04fd |
+ if ((dest = cupsGetDest(name, instance, num_dests, dests)) != NULL)
|
|
Tim Waugh |
6d04fd |
+ dest->is_default = 1;
|
|
Tim Waugh |
6d04fd |
+ }
|
|
Tim Waugh |
6d04fd |
+
|
|
Tim Waugh |
6d04fd |
for (i = num_dests, dest = dests;
|
|
Tim Waugh |
6d04fd |
i > 0 && (!cancel || !*cancel);
|
|
Tim Waugh |
6d04fd |
i --, dest ++)
|