summaryrefslogtreecommitdiff
path: root/systemv/lpstat.c
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-05-26 10:06:54 -0400
committerMichael Sweet <michael.r.sweet@gmail.com>2017-05-26 10:06:54 -0400
commit4b17d76f2a8c16880dc6ab0b2c69c5b4095e5512 (patch)
tree5a2ed2d6c25e91a309794047cde23f6c989d2165 /systemv/lpstat.c
parente1bb4a6e98056c1abb29e59c46d86bfdcbd662f5 (diff)
downloadcups-4b17d76f2a8c16880dc6ab0b2c69c5b4095e5512.tar.gz
Add support for "-e" option in lpstat (Issue #5005)
Diffstat (limited to 'systemv/lpstat.c')
-rw-r--r--systemv/lpstat.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/systemv/lpstat.c b/systemv/lpstat.c
index 6feb00e59..e239e9770 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
@@ -24,6 +24,7 @@
static void check_dest(const char *command, const char *name,
int *num_dests, cups_dest_t **dests);
+static int enum_cb(void *user_data, unsigned flags, cups_dest_t *dest);
static int match_list(const char *list, const char *name);
static int show_accepting(const char *printers, int num_dests,
cups_dest_t *dests);
@@ -240,6 +241,11 @@ main(int argc, /* I - Number of command-line arguments */
show_default(dests);
break;
+ case 'e' : /* List destinations */
+ op = 'e';
+ cupsEnumDests(CUPS_DEST_FLAGS_NONE, 1000, NULL, 0, 0, enum_cb, NULL);
+ break;
+
case 'f' : /* Show forms */
op = 'f';
if (opt[1] != '\0')
@@ -579,6 +585,29 @@ check_dest(const char *command, /* I - Command name */
/*
+ * 'enum_cb()' - Print a destination on the standard output.
+ */
+
+static int /* O - 1 to continue */
+enum_cb(void *user_data, /* I - User data (unused) */
+ unsigned flags, /* I - Enumeration flags */
+ cups_dest_t *dest) /* I - Destination */
+{
+ (void)user_data;
+
+ if (!(flags & CUPS_DEST_FLAGS_REMOVED))
+ {
+ if (dest->instance)
+ printf("%s/%s\n", dest->name, dest->instance);
+ else
+ puts(dest->name);
+ }
+
+ return (1);
+}
+
+
+/*
* 'match_list()' - Match a name from a list of comma or space-separated names.
*/