diff options
author | Leo Howell <leo@lwh.jp> | 2009-11-03 15:56:27 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-11-03 15:56:27 +0900 |
commit | 7ccc90b391c269ce3453275ff8725849ea52ccbe (patch) | |
tree | b7b05b44d04686ccd0e5c920a2da060c90dd43d1 /lpg/libqr/qrgen.c | |
parent | cca340e1b1017f1f565c5c53920e450d75164d51 (diff) | |
download | pdf-simple-sign-7ccc90b391c269ce3453275ff8725849ea52ccbe.tar.gz pdf-simple-sign-7ccc90b391c269ce3453275ff8725849ea52ccbe.tar.xz pdf-simple-sign-7ccc90b391c269ce3453275ff8725849ea52ccbe.zip |
demo app: select ec type, help message
Diffstat (limited to 'lpg/libqr/qrgen.c')
-rw-r--r-- | lpg/libqr/qrgen.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lpg/libqr/qrgen.c b/lpg/libqr/qrgen.c index 8b9f1f0..aee6166 100644 --- a/lpg/libqr/qrgen.c +++ b/lpg/libqr/qrgen.c @@ -1,3 +1,4 @@ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -120,7 +121,14 @@ void output_ansi(const struct qr_bitmap * bmp) } void show_help() { - fprintf(stderr, "(help message)\n"); + fprintf(stderr, + "Usage:\n\t%s [options] <data>\n\n" + "\t-h Display this help message\n" + "\t-v <n> Specify QR version (size) 1 <= n <= 40\n" + "\t-e <type> Specify EC type: L, M, Q, H\n" + "\t-a Output as ANSI graphics (default)\n" + "\t-p Output as PBM\n\n", + "qrgen"); } void set_default_config(struct config * conf) @@ -129,7 +137,7 @@ void set_default_config(struct config * conf) conf->ec = QR_EC_LEVEL_M; conf->dtype = QR_DATA_NUMERIC; conf->ansi = 1; - conf->input = "01234567"; + conf->input = NULL; } void parse_options(int argc, char ** argv, struct config * conf) @@ -156,7 +164,16 @@ void parse_options(int argc, char ** argv, struct config * conf) } break; case 'e': /* ec */ - fprintf(stderr, "XXX: ignored \"ec\"\n"); + switch (tolower(optarg[0])) { + case 'l': conf->ec = QR_EC_LEVEL_L; break; + case 'm': conf->ec = QR_EC_LEVEL_M; break; + case 'q': conf->ec = QR_EC_LEVEL_Q; break; + case 'h': conf->ec = QR_EC_LEVEL_H; break; + default: + fprintf(stderr, + "Invalid EC type (%c). Choose from" + " L, M, Q or H.\n", optarg[0]); + } break; case 't': /* type */ fprintf(stderr, "XXX: ignored \"type\"\n"); |