From df4101bff6f03d551bf6ec81082f8878d2bcc85a Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 6 Dec 2018 11:24:11 -0500 Subject: lpoptions now works with discovered but un-added printers (Issue #5045) --- systemv/lpoptions.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'systemv') diff --git a/systemv/lpoptions.c b/systemv/lpoptions.c index f80319a19..0712c908d 100644 --- a/systemv/lpoptions.c +++ b/systemv/lpoptions.c @@ -1,10 +1,11 @@ /* * Printer option program for CUPS. * - * Copyright 2007-2016 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products. + * Copyright © 2007-2018 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -476,19 +477,32 @@ list_group(ppd_file_t *ppd, /* I - PPD file */ static void list_options(cups_dest_t *dest) /* I - Destination to list */ { + http_t *http; /* Connection to destination */ + char resource[1024]; /* Resource path */ int i; /* Looping var */ const char *filename; /* PPD filename */ ppd_file_t *ppd; /* PPD data */ ppd_group_t *group; /* Current group */ - if ((filename = cupsGetPPD(dest->name)) == NULL) + if ((http = cupsConnectDest(dest, CUPS_DEST_FLAGS_NONE, 30000, NULL, resource, sizeof(resource), NULL, NULL)) == NULL) { _cupsLangPrintf(stderr, _("lpoptions: Unable to get PPD file for %s: %s"), dest->name, cupsLastErrorString()); return; } + if ((filename = cupsGetPPD2(http, dest->name)) == NULL) + { + httpClose(http); + + _cupsLangPrintf(stderr, _("lpoptions: Unable to get PPD file for %s: %s"), + dest->name, cupsLastErrorString()); + return; + } + + httpClose(http); + if ((ppd = ppdOpenFile(filename)) == NULL) { unlink(filename); -- cgit v1.2.1