diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:54:26 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-09-13 11:54:32 +0900 |
commit | cc669fe9bb14b037c6c7d88bea780cf053664b15 (patch) | |
tree | 645f5d4f7de33d361e6f83fe8ec2e815c9335840 /systemv | |
parent | 5ed126d6de36f982f1f800f54d468dac5730050d (diff) | |
download | cups-cc669fe9bb14b037c6c7d88bea780cf053664b15.tar.gz cups-cc669fe9bb14b037c6c7d88bea780cf053664b15.tar.bz2 cups-cc669fe9bb14b037c6c7d88bea780cf053664b15.zip |
Imported Upstream version 2.2.4upstream/2.2.4
Change-Id: I6e6af59f8c880d483a83eb33c963ac9fb5ec2e4d
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'systemv')
-rw-r--r-- | systemv/cupstestppd.c | 2 | ||||
-rw-r--r-- | systemv/lpstat.c | 39 |
2 files changed, 38 insertions, 3 deletions
diff --git a/systemv/cupstestppd.c b/systemv/cupstestppd.c index dbce718..9344c51 100644 --- a/systemv/cupstestppd.c +++ b/systemv/cupstestppd.c @@ -923,7 +923,7 @@ main(int argc, /* I - Number of command-line args */ int junkint; /* Temp integer */ - if (sscanf(attr->value, "(%[^)])%d", junkstr, &junkint) != 2) + if (sscanf(attr->value, "(%254[^)\n])%d", junkstr, &junkint) != 2) { if (verbose >= 0) { diff --git a/systemv/lpstat.c b/systemv/lpstat.c index 6feb00e..cda4571 100644 --- a/systemv/lpstat.c +++ b/systemv/lpstat.c @@ -1,7 +1,7 @@ /* * "lpstat" command for CUPS. * - * Copyright 2007-2016 by Apple Inc. + * Copyright 2007-2017 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -77,7 +77,7 @@ main(int argc, /* I - Number of command-line arguments */ { for (opt = argv[i] + 1; *opt; opt ++) { - switch (argv[i][1]) + switch (*opt) { case 'D' : /* Show description */ long_status = 1; @@ -240,6 +240,41 @@ main(int argc, /* I - Number of command-line arguments */ show_default(dests); break; + case 'e' : /* List destinations */ + { + cups_dest_t *temp = NULL, *dest; + int j, num_temp = cupsGetDests(&temp); + + op = 'e'; + + for (j = num_temp, dest = temp; j > 0; j --, dest ++) + { + if (dest->instance) + printf("%s/%s", dest->name, dest->instance); + else + fputs(dest->name, stdout); + + if (long_status) + { + const char *printer_uri_supported = cupsGetOption("printer-uri-supported", dest->num_options, dest->options); + const char *printer_is_temporary = cupsGetOption("printer-is-temporary", dest->num_options, dest->options); + const char *type = "network"; + + if (printer_is_temporary && !strcmp(printer_is_temporary, "true")) + type = "temporary"; + else if (printer_uri_supported) + type = "permanent"; + + printf(" %s %s %s\n", type, printer_uri_supported ? printer_uri_supported : "none", cupsGetOption("device-uri", dest->num_options, dest->options)); + } + else + putchar('\n'); + } + + cupsFreeDests(num_temp, temp); + } + break; + case 'f' : /* Show forms */ op = 'f'; if (opt[1] != '\0') |