From: msweet Date: Tue, 25 Jun 2013 15:02:18 +0000 (+0000) Subject: The lp and lpr commands incorrectly ignored the default printer set in the X-Git-Tag: release-1.7rc1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5489ad43428a53079eda01c3ba06e6892b5b9372;p=thirdparty%2Fcups.git The lp and lpr commands incorrectly ignored the default printer set in the lpoptions file () git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11060 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-1.6.txt b/CHANGES-1.6.txt index a541a07e2a..7e274ff532 100644 --- a/CHANGES-1.6.txt +++ b/CHANGES-1.6.txt @@ -7,6 +7,8 @@ CHANGES IN CUPS V1.6.3 - Fixed a compile problem on AIX (STR #4307) - Added documentation about the /version=1.1 option to ServerName in client.conf () + - The lp and lpr commands incorrectly ignored the default printer set + in the lpoptions file () - Fixed a URI encoding issue for hostnames containing the ` (backquote) character () - Added support for RFC 6874's IPv6 link local address format in URIs diff --git a/cups/dest.c b/cups/dest.c index 0af7ebaa61..2579d16a3a 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -933,8 +933,8 @@ cupsEnumDests( * Get the list of local printers and pass them to the callback function... */ - num_dests = _cupsGetDests(CUPS_HTTP_DEFAULT, IPP_OP_CUPS_GET_PRINTERS, NULL, &dests, - type, mask); + num_dests = _cupsGetDests(CUPS_HTTP_DEFAULT, IPP_OP_CUPS_GET_PRINTERS, NULL, + &dests, type, mask); for (i = num_dests, dest = dests; i > 0 && (!cancel || !*cancel); @@ -1344,9 +1344,9 @@ _cupsGetDestResource( /* * '_cupsGetDests()' - Get destinations from a server. * - * "op" is IPP_OP_CUPS_GET_PRINTERS to get a full list, IPP_OP_CUPS_GET_DEFAULT to get the - * system-wide default printer, or IPP_OP_GET_PRINTER_ATTRIBUTES for a known - * printer. + * "op" is IPP_OP_CUPS_GET_PRINTERS to get a full list, IPP_OP_CUPS_GET_DEFAULT + * to get the system-wide default printer, or IPP_OP_GET_PRINTER_ATTRIBUTES for + * a known printer. * * "name" is the name of an existing printer and is only used when "op" is * IPP_OP_GET_PRINTER_ATTRIBUTES. @@ -1661,7 +1661,6 @@ int /* O - Number of destinations */ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ cups_dest_t **dests) /* O - Destinations */ { - int i; /* Looping var */ int num_dests; /* Number of destinations */ cups_dest_t *dest; /* Destination pointer */ const char *home; /* HOME environment variable */ @@ -1784,21 +1783,16 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ * Have a default; see if it is real... */ - dest = cupsGetDest(dest->name, NULL, num_reals, reals); - } - - /* - * If dest is NULL, then no default (that exists) is set, so we - * need to set a default if one exists... - */ - - if (!dest && *dests && defprinter) - { - for (i = 0; i < num_dests; i ++) - (*dests)[i].is_default = 0; + if (!cupsGetDest(dest->name, NULL, num_reals, reals)) + { + /* + * Remove the non-real printer from the list, since we don't want jobs + * going to an unexpected printer... () + */ - if ((dest = cupsGetDest(name, instance, num_dests, *dests)) != NULL) - dest->is_default = 1; + num_dests = cupsRemoveDest(dest->name, dest->instance, num_dests, + dests); + } } /* diff --git a/cups/testcups.c b/cups/testcups.c index 63e9478d6d..00a22965ac 100644 --- a/cups/testcups.c +++ b/cups/testcups.c @@ -24,6 +24,7 @@ * Include necessary headers... */ +#undef _CUPS_NO_DEPRECATED #include "string-private.h" #include "cups.h" #include "ppd.h" diff --git a/cups/testppd.c b/cups/testppd.c index aa4a060684..aee7db4656 100644 --- a/cups/testppd.c +++ b/cups/testppd.c @@ -3,7 +3,7 @@ * * PPD test program for CUPS. * - * Copyright 2007-2012 by Apple Inc. + * Copyright 2007-2013 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -23,6 +23,7 @@ * Include necessary headers... */ +#undef _CUPS_NO_DEPRECATED #include "cups-private.h" #include #ifdef WIN32