summaryrefslogtreecommitdiff
path: root/systemv
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-12-06 22:43:57 -0500
committerMichael Sweet <michael.r.sweet@gmail.com>2017-12-06 22:43:57 -0500
commitf306ad4d329883820d188b71582e677b277646c7 (patch)
treeaee6f043e22d1cd3f066a8392aa61567997d87d3 /systemv
parentfce9ddcbeed910e86c0381d696a6dc387b65ac71 (diff)
downloadcups-f306ad4d329883820d188b71582e677b277646c7.tar.gz
Finalize printer and class information in new administration guide.
Update lpadmin to copy printer-info, printer-location, and printer-geo-location from the IPP printer when using the "everywhere" driver. Update lpinfo to list the "everywhere" driver.
Diffstat (limited to 'systemv')
-rw-r--r--systemv/lpadmin.c37
-rw-r--r--systemv/lpinfo.c21
2 files changed, 50 insertions, 8 deletions
diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c
index 565b51f9a..a43295b5b 100644
--- a/systemv/lpadmin.c
+++ b/systemv/lpadmin.c
@@ -29,7 +29,7 @@ static int delete_printer_from_class(http_t *http, char *printer,
static int delete_printer_option(http_t *http, char *printer,
char *option);
static int enable_printer(http_t *http, char *printer);
-static char *get_printer_ppd(const char *uri, char *buffer, size_t bufsize);
+static char *get_printer_ppd(const char *uri, char *buffer, size_t bufsize, int *num_options, cups_option_t **options);
static cups_ptype_t get_printer_type(http_t *http, char *printer, char *uri,
size_t urisize);
static int set_printer_options(http_t *http, char *printer,
@@ -608,7 +608,7 @@ main(int argc, /* I - Number of command-line arguments */
if ((ppd_name = cupsGetOption("ppd-name", num_options, options)) != NULL && !strcmp(ppd_name, "everywhere") && (device_uri = cupsGetOption("device-uri", num_options, options)) != NULL)
{
- if ((file = get_printer_ppd(device_uri, evefile, sizeof(evefile))) == NULL)
+ if ((file = get_printer_ppd(device_uri, evefile, sizeof(evefile), &num_options, &options)) == NULL)
return (1);
num_options = cupsRemoveOption("ppd-name", num_options, &options);
@@ -1159,20 +1159,31 @@ enable_printer(http_t *http, /* I - Server connection */
* 'get_printer_ppd()' - Get an IPP Everywhere PPD file for the given URI.
*/
-static char * /* O - Filename or NULL */
-get_printer_ppd(const char *uri, /* I - Printer URI */
- char *buffer, /* I - Filename buffer */
- size_t bufsize) /* I - Size of filename buffer */
+static char * /* O - Filename or NULL */
+get_printer_ppd(
+ const char *uri, /* I - Printer URI */
+ char *buffer, /* I - Filename buffer */
+ size_t bufsize, /* I - Size of filename buffer */
+ int *num_options, /* IO - Number of options */
+ cups_option_t **options) /* IO - Options */
{
http_t *http; /* Connection to printer */
ipp_t *request, /* Get-Printer-Attributes request */
*response; /* Get-Printer-Attributes response */
+ ipp_attribute_t *attr; /* Attribute from response */
char resolved[1024], /* Resolved URI */
scheme[32], /* URI scheme */
userpass[256], /* Username:password */
host[256], /* Hostname */
resource[256]; /* Resource path */
int port; /* Port number */
+ static const char * const pattrs[] = /* Attributes to use */
+ {
+ "job-template",
+ "printer-defaults",
+ "printer-description",
+ "media-col-database"
+ };
/*
@@ -1213,9 +1224,21 @@ get_printer_ppd(const char *uri, /* I - Printer URI */
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
+ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]), NULL, pattrs);
response = cupsDoRequest(http, request, resource);
- if (!_ppdCreateFromIPP(buffer, bufsize, response))
+ if (_ppdCreateFromIPP(buffer, bufsize, response))
+ {
+ if (!cupsGetOption("printer-geo-location", *num_options, *options) && (attr = ippFindAttribute(response, "printer-geo-location", IPP_TAG_URI)) != NULL)
+ *num_options = cupsAddOption("printer-geo-location", ippGetString(attr, 0, NULL), *num_options, options);
+
+ if (!cupsGetOption("printer-info", *num_options, *options) && (attr = ippFindAttribute(response, "printer-info", IPP_TAG_TEXT)) != NULL)
+ *num_options = cupsAddOption("printer-info", ippGetString(attr, 0, NULL), *num_options, options);
+
+ if (!cupsGetOption("printer-location", *num_options, *options) && (attr = ippFindAttribute(response, "printer-location", IPP_TAG_TEXT)) != NULL)
+ *num_options = cupsAddOption("printer-location", ippGetString(attr, 0, NULL), *num_options, options);
+ }
+ else
_cupsLangPrintf(stderr, _("%s: Unable to create PPD file: %s"), "lpadmin", strerror(errno));
ippDelete(response);
diff --git a/systemv/lpinfo.c b/systemv/lpinfo.c
index 24175b69b..54214a773 100644
--- a/systemv/lpinfo.c
+++ b/systemv/lpinfo.c
@@ -1,7 +1,7 @@
/*
* "lpinfo" command for CUPS.
*
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
@@ -450,6 +450,25 @@ show_models(
}
ippDelete(response);
+
+ /*
+ * Show the "everywhere" model, which is handled by the lpadmin command...
+ */
+
+ if ((!include_schemes || strstr(include_schemes, "everywhere")) && (!exclude_schemes || !strstr(exclude_schemes, "everywhere")))
+ {
+ if (long_status)
+ {
+ _cupsLangPrintf(stdout,
+ _("Model: name = %s\n"
+ " natural_language = %s\n"
+ " make-and-model = %s\n"
+ " device-id = %s"),
+ "everywhere", cupsLangDefault()->language, "IPP Everywhere", "CMD:PwgRaster");
+ }
+ else
+ _cupsLangPuts(stdout, "everywhere IPP Everywhere");
+ }
}
else
{