summaryrefslogtreecommitdiffstats
path: root/backend_common.h
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2015-08-13 21:09:56 -0400
committerSolomon Peachy <pizza@shaftnet.org>2015-08-13 21:09:56 -0400
commitdf81742e3b03e2b2f1553f08e3fea3e2e6112bf3 (patch)
treee43b8516c1d72e464a4a2598837d81aa249aca9c /backend_common.h
parentb3c3d1e2b12288aa939b8bc0d64f11cf479299bb (diff)
downloadselphy_print-df81742e3b03e2b2f1553f08e3fea3e2e6112bf3.tar.gz
selphy_print-df81742e3b03e2b2f1553f08e3fea3e2e6112bf3.tar.bz2
selphy_print-df81742e3b03e2b2f1553f08e3fea3e2e6112bf3.zip
all: Eliminate the multi-stage cmdline parsing.
Unfortunately this means we lose the '-B backend' method, but the overall control flow is much, much simpler now.
Diffstat (limited to 'backend_common.h')
-rw-r--r--backend_common.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/backend_common.h b/backend_common.h
index 96156c5..14ddf23 100644
--- a/backend_common.h
+++ b/backend_common.h
@@ -148,6 +148,9 @@ int read_data(struct libusb_device_handle *dev, uint8_t endp,
uint8_t *buf, int buflen, int *readlen);
int lookup_printer_type(struct dyesub_backend *backend, uint16_t idVendor, uint16_t idProduct);
+void print_license_blurb(void);
+void print_help(char *argv0, struct dyesub_backend *backend);
+
/* Global data */
extern int terminate;
extern int dyesub_debug;
@@ -155,6 +158,12 @@ extern int fast_return;
extern int extra_vid;
extern int extra_pid;
extern int extra_type;
+extern int copies;
+extern char *use_serno;
+
+#if defined(BACKEND)
+extern struct dyesub_backend BACKEND;
+#endif
/* CUPS compatibility */
#define CUPS_BACKEND_OK 0 /* Sucess */
@@ -166,4 +175,35 @@ extern int extra_type;
#define CUPS_BACKEND_RETRY 6 /* Retry later */
#define CUPS_BACKEND_RETRY_CURRENT 7 /* Retry immediately */
+/* Argument processing */
+#define GETOPT_LIST_GLOBAL "d:DfGhP:S:T:V:"
+#define GETOPT_PROCESS_GLOBAL \
+ case 'd': \
+ copies = atoi(optarg); \
+ break; \
+ case 'D': \
+ dyesub_debug++; \
+ break; \
+ case 'f': \
+ fast_return++; \
+ break; \
+ case 'G': \
+ print_license_blurb(); \
+ exit(0); \
+ case 'h': \
+ print_help(argv[0], &BACKEND); \
+ exit(0); \
+ case 'P': \
+ extra_pid = strtol(optarg, NULL, 16); \
+ break; \
+ case 'S': \
+ use_serno = optarg; \
+ break; \
+ case 'T': \
+ extra_type = atoi(optarg); \
+ break; \
+ case 'V': \
+ extra_pid = strtol(optarg, NULL, 16); \
+ break;
+
#endif /* __BACKEND_COMMON_H */