diff options
author | Dominic Radermacher <blip@mockmoon-cybernetics.ch> | 2020-09-26 11:34:02 +0200 |
---|---|---|
committer | Dominic Radermacher <blip@mockmoon-cybernetics.ch> | 2020-09-26 11:34:02 +0200 |
commit | 32c0d3be29f9eebb5d0e48f4f998da83b0c2ff3c (patch) | |
tree | 405bc5bd56bcfbe67175b8be1b5ea33f7e28a76d | |
parent | 53f15661de74583d8023f69d3a5beb03e2757275 (diff) |
add --list-supported command, fix errors in help page
-rw-r--r-- | include/ptouch.h | 1 | ||||
-rw-r--r-- | src/libptouch.c | 11 | ||||
-rw-r--r-- | src/ptouch-print.c | 13 |
3 files changed, 22 insertions, 3 deletions
diff --git a/include/ptouch.h b/include/ptouch.h index 61db5c8..2630994 100644 --- a/include/ptouch.h +++ b/include/ptouch.h @@ -104,3 +104,4 @@ int ptouch_getmaxwidth(ptouch_dev ptdev); int ptouch_enable_packbits(ptouch_dev ptdev); int ptouch_rasterstart(ptouch_dev ptdev); int ptouch_sendraster(ptouch_dev ptdev, uint8_t *data, size_t len); +void ptouch_list_supported(); diff --git a/src/libptouch.c b/src/libptouch.c index 9f81d1c..673c76e 100644 --- a/src/libptouch.c +++ b/src/libptouch.c @@ -330,3 +330,14 @@ int ptouch_sendraster(ptouch_dev ptdev, uint8_t *data, size_t len) } return rc; } + +void ptouch_list_supported() +{ + printf("Supported printers (some might have quirks)\n"); + for (int i=0; ptdevs[i].vid > 0; i++) { + if ((ptdevs[i].flags & FLAG_PLITE) != FLAG_PLITE) { + printf("\t%s\n", ptdevs[i].name); + } + } + return; +} diff --git a/src/ptouch-print.c b/src/ptouch-print.c index ebb634f..145e647 100644 --- a/src/ptouch-print.c +++ b/src/ptouch-print.c @@ -360,17 +360,21 @@ void usage(char *progname) { printf("usage: %s [options] <print-command(s)>\n", progname); printf("options:\n"); + printf("\t--debug\t\t\tenable debug output\n"); printf("\t--font <file>\t\tuse font <file> or <name>\n"); + printf("\t--fontsize <size>\tManually set fontsize\n"); printf("\t--writepng <file>\tinstead of printing, write output to png file\n"); - printf("\t\t\t\tThis currently works only when using\n\t\t\t\tEXACTLY ONE --text statement\n"); - printf("print-commands:\n"); + printf("print commands:\n"); printf("\t--image <file>\t\tprint the given image which must be a 2 color\n"); printf("\t\t\t\t(black/white) png\n"); printf("\t--text <text>\t\tPrint 1-4 lines of text.\n"); printf("\t\t\t\tIf the text contains spaces, use quotation marks\n\t\t\t\taround it.\n"); printf("\t--cutmark\t\tPrint a mark where the tape should be cut\n"); - printf("\t--fontsize\t\tManually set fontsize\n"); printf("\t--pad <n>\t\tAdd n pixels padding (blank tape)\n"); + printf("other commands:\n"); + printf("\t--version\t\tshow version info (required for bug report)\n"); + printf("\t--info\t\t\tshow info about detected tape\n"); + printf("\t--list-supported\tshow printers supported by this version\n"); exit(1); } @@ -429,6 +433,9 @@ int parse_args(int argc, char **argv) } else if (strcmp(&argv[i][1], "-version") == 0) { printf(_("ptouch-print version %s by Dominic Radermacher\n"), VERSION); exit(0); + } else if (strcmp(&argv[i][1], "-list-supported") == 0) { + ptouch_list_supported(); + exit(0); } else { usage(argv[0]); } |