diff options
author | Hartmut Goebel <h.goebel@crazy-compilers.com> | 2019-03-02 12:37:46 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-04-03 13:42:16 +0200 |
commit | 2a302e5716711e4bae796ac3c272972859a3a122 (patch) | |
tree | 27e6f4af673486da9519b3186081a6c803a281be | |
parent | c7ec9cc03a383a33315c9cc126ebbf73135a17cc (diff) | |
download | gnunet-2a302e5716711e4bae796ac3c272972859a3a122.tar.gz gnunet-2a302e5716711e4bae796ac3c272972859a3a122.zip |
gnunet-qr: Simplify verbose messaging.
-rw-r--r-- | src/util/gnunet-qr.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c index c02212a51..b375d20a7 100644 --- a/src/util/gnunet-qr.c +++ b/src/util/gnunet-qr.c | |||
@@ -38,6 +38,8 @@ static const char *usage_note = | |||
38 | "GNUnet home page: https://gnunet.org/\n" | 38 | "GNUnet home page: https://gnunet.org/\n" |
39 | "General help using GNU software: https://www.gnu.org/gethelp/\n"; | 39 | "General help using GNU software: https://www.gnu.org/gethelp/\n"; |
40 | 40 | ||
41 | #define LOG(fmt, ...) if (verbose == true) printf(fmt, ## __VA_ARGS__) | ||
42 | |||
41 | int main (int argc, char **argv) | 43 | int main (int argc, char **argv) |
42 | { | 44 | { |
43 | const char* configuration = NULL; | 45 | const char* configuration = NULL; |
@@ -83,9 +85,7 @@ int main (int argc, char **argv) | |||
83 | } | 85 | } |
84 | 86 | ||
85 | /* create a Processor */ | 87 | /* create a Processor */ |
86 | if (verbose == true) { | 88 | LOG("Initializing\n"); |
87 | printf("Initializing\n"); | ||
88 | }; | ||
89 | zbar_processor_t *proc = zbar_processor_create(1); | 89 | zbar_processor_t *proc = zbar_processor_create(1); |
90 | 90 | ||
91 | // FIXME: Wrap all this into a function which returns an error on | 91 | // FIXME: Wrap all this into a function which returns an error on |
@@ -95,9 +95,7 @@ int main (int argc, char **argv) | |||
95 | zbar_processor_parse_config(proc, "enable"); | 95 | zbar_processor_parse_config(proc, "enable"); |
96 | 96 | ||
97 | /* initialize the Processor */ | 97 | /* initialize the Processor */ |
98 | if (verbose == true) { | 98 | LOG("Opening video device %s\n", device); |
99 | printf("Opening video device %s\n", device); | ||
100 | }; | ||
101 | // FIXME: error handling | 99 | // FIXME: error handling |
102 | zbar_processor_init(proc, device, 1); | 100 | zbar_processor_init(proc, device, 1); |
103 | 101 | ||
@@ -109,14 +107,10 @@ int main (int argc, char **argv) | |||
109 | //zbar_processor_user_wait(proc, -1); | 107 | //zbar_processor_user_wait(proc, -1); |
110 | 108 | ||
111 | // read at least one barcode (or until window closed) | 109 | // read at least one barcode (or until window closed) |
112 | if (verbose == true) { | 110 | LOG("Capturing\n"); |
113 | printf("Capturing\n"); | ||
114 | } | ||
115 | int n; | 111 | int n; |
116 | n = zbar_process_one(proc, -1); | 112 | n = zbar_process_one(proc, -1); |
117 | if (verbose == true) { | 113 | LOG("Got %i images\n", n); |
118 | printf("Got %i images\n", n); | ||
119 | }; | ||
120 | // FIXME: Error handling (n = -1) | 114 | // FIXME: Error handling (n = -1) |
121 | 115 | ||
122 | // hide the preview window | 116 | // hide the preview window |
@@ -131,11 +125,9 @@ int main (int argc, char **argv) | |||
131 | 125 | ||
132 | if (symbol != NULL) { | 126 | if (symbol != NULL) { |
133 | const char* data = zbar_symbol_get_data(symbol); | 127 | const char* data = zbar_symbol_get_data(symbol); |
134 | if (verbose = true) { | 128 | LOG("Found %s \"%s\"\n", |
135 | zbar_symbol_type_t type = | 129 | zbar_get_symbol_name(zbar_symbol_get_type(symbol)), data); |
136 | printf("Found %s \"%s\"\n", | 130 | |
137 | zbar_get_symbol_name(zbar_symbol_get_type(symbol)), data); | ||
138 | } | ||
139 | /* TODO | 131 | /* TODO |
140 | args = ["gnunet-uri", | 132 | args = ["gnunet-uri", |
141 | // FIXME: "-c", configuration, | 133 | // FIXME: "-c", configuration, |