aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/gnunet-qr.c26
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
41int main (int argc, char **argv) 43int 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,