summaryrefslogtreecommitdiff
path: root/systemv
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-05-26 10:59:07 -0400
committerMichael Sweet <michael.r.sweet@gmail.com>2017-05-26 10:59:07 -0400
commit9022d60bbde151c462741887ae704117aa57f6d1 (patch)
tree091c19dd79e4b11756f69103bd2ac4b785596929 /systemv
parentf8d0ab6d14bfe8089bedc2269fd084d4b4c869b6 (diff)
downloadcups-9022d60bbde151c462741887ae704117aa57f6d1.tar.gz
Rework lpstat -e to use cupsGetDests to eliminate duplicates (Issue #5005)
Diffstat (limited to 'systemv')
-rw-r--r--systemv/lpstat.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/systemv/lpstat.c b/systemv/lpstat.c
index e239e9770..a3474a6d7 100644
--- a/systemv/lpstat.c
+++ b/systemv/lpstat.c
@@ -24,7 +24,6 @@
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);
@@ -242,8 +241,23 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'e' : /* List destinations */
- op = 'e';
- cupsEnumDests(CUPS_DEST_FLAGS_NONE, 1000, NULL, 0, 0, enum_cb, NULL);
+ {
+ 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\n", dest->name, dest->instance);
+ else
+ puts(dest->name);
+ }
+
+ cupsFreeDests(num_temp, temp);
+ }
+
break;
case 'f' : /* Show forms */
@@ -585,29 +599,6 @@ 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.
*/