From eb053ceb1afb09465df189616f632696f40f1d6e Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 29 Aug 2015 08:24:54 -0400 Subject: [PATCH] common: Export current page to backends. --- backend_common.c | 10 +++++----- backend_common.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend_common.c b/backend_common.c index 2b8dd39..97729ef 100644 --- a/backend_common.c +++ b/backend_common.c @@ -27,7 +27,7 @@ #include "backend_common.h" -#define BACKEND_VERSION "0.61" +#define BACKEND_VERSION "0.62" #ifndef URI_PREFIX #error "Must Define URI_PREFIX" #endif @@ -43,6 +43,7 @@ int extra_pid = -1; int extra_type = -1; int copies = 1; char *use_serno = NULL; +int current_page = 0; /* Support Functions */ static int backend_claim_interface(struct libusb_device_handle *dev, int iface) @@ -756,7 +757,6 @@ int main (int argc, char **argv) int iface = 0; int found = -1; int jobid = 0; - int pages = 0; char *uri; char *fname = NULL; @@ -987,13 +987,13 @@ newpage: /* Read in data */ if ((ret = backend->read_parse(backend_ctx, data_fd))) { - if (pages) + if (current_page) goto done_multiple; else goto done_claimed; } - INFO("Printing page %d\n", ++pages); + INFO("Printing page %d\n", ++current_page); ret = backend->main_loop(backend_ctx, copies); if (ret) @@ -1008,7 +1008,7 @@ done_multiple: close(data_fd); /* Done printing */ - INFO("All printing done (%d pages * %d copies)\n", pages, copies); + INFO("All printing done (%d pages * %d copies)\n", current_page, copies); ret = CUPS_BACKEND_OK; done_claimed: diff --git a/backend_common.h b/backend_common.h index 52b96a6..c6f340b 100644 --- a/backend_common.h +++ b/backend_common.h @@ -163,6 +163,7 @@ extern int extra_pid; extern int extra_type; extern int copies; extern char *use_serno; +extern int current_page; #if defined(BACKEND) extern struct dyesub_backend BACKEND;