Commit 6443e9ad398cdbdd30de7480b251fd5e13ea9bcb

Authored by Arnaud Blanchard
1 parent d3a1a460

Fix option size (-s) and set default quiting key 'return'

Showing 1 changed file with 112 additions and 106 deletions
@@ -8,15 +8,15 @@ @@ -8,15 +8,15 @@
8 enum{NORMAL_KEY=0, QUIT_KEY, NEUTRAL_KEY, INDEX_KEY, ARROW_CHANGE_INDEX, WRONG_KEY, DECREMENT_KEY, INCREMENT_KEY, FAST_DECREMENT_KEY, FAST_INCREMENT_KEY}; 8 enum{NORMAL_KEY=0, QUIT_KEY, NEUTRAL_KEY, INDEX_KEY, ARROW_CHANGE_INDEX, WRONG_KEY, DECREMENT_KEY, INCREMENT_KEY, FAST_DECREMENT_KEY, FAST_INCREMENT_KEY};
9 enum { LEFT_ARROW='D', RIGHT_ARROW='C', UP_ARROW='A', DOWN_ARROW='B'}; 9 enum { LEFT_ARROW='D', RIGHT_ARROW='C', UP_ARROW='A', DOWN_ARROW='B'};
10 10
11 -blc_channel channel;  
12 -blc_mem table;  
13 -char *key_list;  
14 -char const *display;  
15 -int keys_nb;  
16 -uchar min, max;  
17 -uchar quitting_key, neutral_key;  
18 -float neutral_value, max_value, min_value, float_step_size=0.004;  
19 -uchar uchar_step_size=1; 11 +static blc_channel channel;
  12 +static blc_mem table;
  13 +static char *key_list;
  14 +static char const *display;
  15 +static int keys_nb;
  16 +static uchar min, max;
  17 +static uchar quitting_key=0, neutral_key;
  18 +static float neutral_value, max_value, min_value, float_step_size=0.004;
  19 +static uchar uchar_step_size=1;
20 20
21 //quitting key return -1, neutral return -2; 21 //quitting key return -1, neutral return -2;
22 static int update_index(int *index){ 22 static int update_index(int *index){
@@ -37,28 +37,28 @@ static int update_index(int *index){ @@ -37,28 +37,28 @@ static int update_index(int *index){
37 } if (ret==2){ 37 } if (ret==2){
38 switch (answer[1]){ 38 switch (answer[1]){
39 default:fprintf(stderr, "\nImpossible key of '%ld' bytes. Byte 0 '%c','%d', byte 1, '%c','%d'\n", ret, answer[0], answer[0], answer[1], answer[1]); 39 default:fprintf(stderr, "\nImpossible key of '%ld' bytes. Byte 0 '%c','%d', byte 1, '%c','%d'\n", ret, answer[0], answer[0], answer[1], answer[1]);
40 - break; 40 + break;
41 } 41 }
42 } 42 }
43 else if (ret==3){ 43 else if (ret==3){
44 if ((answer[0]==27 && answer[1]=='[') || (answer[0]==239 && answer[1]==156)) { 44 if ((answer[0]==27 && answer[1]=='[') || (answer[0]==239 && answer[1]==156)) {
45 switch (answer[2]){ 45 switch (answer[2]){
46 case LEFT_ARROW: case 130: *index=MAX(0, *index-1); 46 case LEFT_ARROW: case 130: *index=MAX(0, *index-1);
47 - return ARROW_CHANGE_INDEX;  
48 - break; 47 + return ARROW_CHANGE_INDEX;
  48 + break;
49 case RIGHT_ARROW: case 131: *index=MIN(keys_nb-1, *index+1); 49 case RIGHT_ARROW: case 131: *index=MIN(keys_nb-1, *index+1);
50 - return ARROW_CHANGE_INDEX;  
51 - break; 50 + return ARROW_CHANGE_INDEX;
  51 + break;
52 case UP_ARROW:case 128: return INCREMENT_KEY; 52 case UP_ARROW:case 128: return INCREMENT_KEY;
53 - break; 53 + break;
54 case DOWN_ARROW:case 129: return DECREMENT_KEY; 54 case DOWN_ARROW:case 129: return DECREMENT_KEY;
55 - break;  
56 - /* case PAGE_UP:case 172: return FAST_INCREMENT_KEY;  
57 - break;  
58 - case PAGE_DOWN:case 173: return FAST_DECREMENT_KEY;  
59 - break;*/ 55 + break;
  56 + /* case PAGE_UP:case 172: return FAST_INCREMENT_KEY;
  57 + break;
  58 + case PAGE_DOWN:case 173: return FAST_DECREMENT_KEY;
  59 + break;*/
60 default: fprintf(stderr, "This key does not have effect\n"); 60 default: fprintf(stderr, "This key does not have effect\n");
61 - break; 61 + break;
62 } 62 }
63 } 63 }
64 printf("Answer 0 '%c','%d', answer 1, '%c','%d', 2: '%c','%d'\n" , answer[0], answer[0] , answer[1], answer[1], answer[2], answer[2]); 64 printf("Answer 0 '%c','%d', answer 1, '%c','%d', 2: '%c','%d'\n" , answer[0], answer[0] , answer[1], answer[1], answer[2], answer[2]);
@@ -105,18 +105,18 @@ static void loop_toggle_uchar(){ @@ -105,18 +105,18 @@ static void loop_toggle_uchar(){
105 ret=update_index(&index); 105 ret=update_index(&index);
106 switch (ret){ 106 switch (ret){
107 case INCREMENT_KEY: 107 case INCREMENT_KEY:
108 - channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(max_value);  
109 - break; 108 + channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(max_value);
  109 + break;
110 case DECREMENT_KEY: channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(min_value); 110 case DECREMENT_KEY: channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(min_value);
111 - break; 111 + break;
112 case NEUTRAL_KEY: 112 case NEUTRAL_KEY:
113 - channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(neutral_value);  
114 - break; 113 + channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(neutral_value);
  114 + break;
115 case INDEX_KEY: 115 case INDEX_KEY:
116 - if (channel.uchars[index] > BLC_NORMED_FLOAT_TO_UCHAR(neutral_value)) channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(min_value);  
117 - else channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(max_value); 116 + if (channel.uchars[index] > BLC_NORMED_FLOAT_TO_UCHAR(neutral_value)) channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(min_value);
  117 + else channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(max_value);
118 case ARROW_CHANGE_INDEX:case QUIT_KEY: 118 case ARROW_CHANGE_INDEX:case QUIT_KEY:
119 - break; 119 + break;
120 default:color_eprintf(BLC_YELLOW, "Unknownd ret '%d'", ret); 120 default:color_eprintf(BLC_YELLOW, "Unknownd ret '%d'", ret);
121 } 121 }
122 122
@@ -139,22 +139,22 @@ static void loop_uchar(){ @@ -139,22 +139,22 @@ static void loop_uchar(){
139 ret=update_index(&index); 139 ret=update_index(&index);
140 switch (ret){ 140 switch (ret){
141 case INCREMENT_KEY: 141 case INCREMENT_KEY:
142 - channel.uchars[index]=MIN(channel.uchars[index]+uchar_step_size, BLC_NORMED_FLOAT_TO_UCHAR(max_value));  
143 - break; 142 + channel.uchars[index]=MIN(channel.uchars[index]+uchar_step_size, BLC_NORMED_FLOAT_TO_UCHAR(max_value));
  143 + break;
144 case DECREMENT_KEY: channel.uchars[index]=MAX(channel.uchars[index]-uchar_step_size, BLC_NORMED_FLOAT_TO_UCHAR(min_value)); 144 case DECREMENT_KEY: channel.uchars[index]=MAX(channel.uchars[index]-uchar_step_size, BLC_NORMED_FLOAT_TO_UCHAR(min_value));
145 - break;  
146 - /* case FAST_INCREMENT_KEY:  
147 - channel.uchars[index]=MIN(channel.uchars[index]+10*uchar_step_size, UINT8_MAX);  
148 - previous_index=index;  
149 - break;  
150 - case FAST_DECREMENT_KEY:  
151 - channel.uchars[index]=MAX(channel.uchars[index]-10*uchar_step_size, 0);  
152 - break;*/ 145 + break;
  146 + /* case FAST_INCREMENT_KEY:
  147 + channel.uchars[index]=MIN(channel.uchars[index]+10*uchar_step_size, UINT8_MAX);
  148 + previous_index=index;
  149 + break;
  150 + case FAST_DECREMENT_KEY:
  151 + channel.uchars[index]=MAX(channel.uchars[index]-10*uchar_step_size, 0);
  152 + break;*/
153 case NEUTRAL_KEY: 153 case NEUTRAL_KEY:
154 - channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(neutral_value);  
155 - break; 154 + channel.uchars[index]=BLC_NORMED_FLOAT_TO_UCHAR(neutral_value);
  155 + break;
156 case INDEX_KEY:case QUIT_KEY:case ARROW_CHANGE_INDEX: 156 case INDEX_KEY:case QUIT_KEY:case ARROW_CHANGE_INDEX:
157 - break; 157 + break;
158 default:EXIT_ON_ERROR("Unknownd ret '%d'", ret); 158 default:EXIT_ON_ERROR("Unknownd ret '%d'", ret);
159 } 159 }
160 } 160 }
@@ -172,18 +172,18 @@ static void loop_toggle_float(){ @@ -172,18 +172,18 @@ static void loop_toggle_float(){
172 ret=update_index(&index); 172 ret=update_index(&index);
173 switch (ret){ 173 switch (ret){
174 case INCREMENT_KEY: 174 case INCREMENT_KEY:
175 - channel.floats[index]=max_value;  
176 - break; 175 + channel.floats[index]=max_value;
  176 + break;
177 case DECREMENT_KEY: channel.floats[index]=min_value; 177 case DECREMENT_KEY: channel.floats[index]=min_value;
178 - break; 178 + break;
179 case NEUTRAL_KEY: 179 case NEUTRAL_KEY:
180 - channel.floats[index]=neutral_value;  
181 - break; 180 + channel.floats[index]=neutral_value;
  181 + break;
182 case INDEX_KEY: 182 case INDEX_KEY:
183 - if (channel.floats[index] > neutral_value) channel.floats[index]=min_value;  
184 - else channel.floats[index]=max_value; 183 + if (channel.floats[index] > neutral_value) channel.floats[index]=min_value;
  184 + else channel.floats[index]=max_value;
185 case ARROW_CHANGE_INDEX:case QUIT_KEY: 185 case ARROW_CHANGE_INDEX:case QUIT_KEY:
186 - break; 186 + break;
187 default:color_eprintf(BLC_YELLOW, "Unknownd ret '%d'", ret); 187 default:color_eprintf(BLC_YELLOW, "Unknownd ret '%d'", ret);
188 } 188 }
189 } 189 }
@@ -201,17 +201,17 @@ static void loop_float(){ @@ -201,17 +201,17 @@ static void loop_float(){
201 ret=update_index(&index); 201 ret=update_index(&index);
202 switch (ret){ 202 switch (ret){
203 case INCREMENT_KEY: channel.floats[index]=MIN(channel.floats[index]+float_step_size, max_value); 203 case INCREMENT_KEY: channel.floats[index]=MIN(channel.floats[index]+float_step_size, max_value);
204 - break; 204 + break;
205 case DECREMENT_KEY: channel.floats[index]=MAX(channel.floats[index]-float_step_size, min_value); 205 case DECREMENT_KEY: channel.floats[index]=MAX(channel.floats[index]-float_step_size, min_value);
206 - break;  
207 - /* case FAST_INCREMENT_KEY: channel.floats[index]+=float_step_size*10;  
208 - break;  
209 - case FAST_DECREMENT_KEY:channel.floats[index]-=float_step_size*10;  
210 - break;*/ 206 + break;
  207 + /* case FAST_INCREMENT_KEY: channel.floats[index]+=float_step_size*10;
  208 + break;
  209 + case FAST_DECREMENT_KEY:channel.floats[index]-=float_step_size*10;
  210 + break;*/
211 case NEUTRAL_KEY:channel.floats[index]=neutral_value; 211 case NEUTRAL_KEY:channel.floats[index]=neutral_value;
212 - break; 212 + break;
213 case INDEX_KEY: case ARROW_CHANGE_INDEX: 213 case INDEX_KEY: case ARROW_CHANGE_INDEX:
214 - previous_index=index; 214 + previous_index=index;
215 case QUIT_KEY:break; 215 case QUIT_KEY:break;
216 default:EXIT_ON_ERROR("Unknownd ret '%d'", ret); 216 default:EXIT_ON_ERROR("Unknownd ret '%d'", ret);
217 } 217 }
@@ -233,15 +233,15 @@ int main(int argc, char** argv){ @@ -233,15 +233,15 @@ int main(int argc, char** argv){
233 233
234 asprintf(&default_output, "/%s%d", basename(argv[0]), getpid()); //This will not be free but it is only allocate once 234 asprintf(&default_output, "/%s%d", basename(argv[0]), getpid()); //This will not be free but it is only allocate once
235 blc_program_set_description("Get keyboard inputs"); 235 blc_program_set_description("Get keyboard inputs");
236 - blc_program_add_option(&display, 'd', "display", NULL, "Display a text graph (UIN8 only)", NULL); 236 + blc_program_add_option(&display, 'd', "display", NULL, "Display a text graph", NULL);
237 blc_program_add_option(&filename, 'f', "file", "filename", "Initialize the values with a tsv file", NULL); 237 blc_program_add_option(&filename, 'f', "file", "filename", "Initialize the values with a tsv file", NULL);
238 blc_program_add_option((char const**)&key_list, 'k', "key_list", "string", "Define all the keys that can be stroke", NULL); 238 blc_program_add_option((char const**)&key_list, 'k', "key_list", "string", "Define all the keys that can be stroke", NULL);
239 blc_program_add_option(&min_str, 'm', "min", "real", "Define the normed minimum value", "0.0"); 239 blc_program_add_option(&min_str, 'm', "min", "real", "Define the normed minimum value", "0.0");
240 blc_program_add_option(&str_neutral_key, 'n', "neutral_key", "string", "Define the neutral key", "escape"); 240 blc_program_add_option(&str_neutral_key, 'n', "neutral_key", "string", "Define the neutral key", "escape");
241 blc_program_add_option(&channel_name, 'o', "output", "blc_channel", "Define where the result will be put", default_output); 241 blc_program_add_option(&channel_name, 'o', "output", "blc_channel", "Define where the result will be put", default_output);
242 - blc_program_add_option(&str_quitting_key, 'q', "quitting_key", "string", "Define the key used to quit", "q"); 242 + blc_program_add_option(&str_quitting_key, 'q', "quitting_key", "string", "Define the key used to quit", "return");
243 blc_program_add_option(&key_nb_str, 's', "size", "integer", "Size of key vector", NULL); 243 blc_program_add_option(&key_nb_str, 's', "size", "integer", "Size of key vector", NULL);
244 - blc_program_add_option(&type_str, 't', "type", "UIN8|FL32", "Define the type of the result", NULL); 244 + blc_program_add_option(&type_str, 't', "type", "UIN8|FL32", "Define the type of the result (default 'UIN8')", NULL);
245 blc_program_add_option(&file_select_name, 'F', "select", "filename", "File among which values will be selected", NULL); 245 blc_program_add_option(&file_select_name, 'F', "select", "filename", "File among which values will be selected", NULL);
246 blc_program_add_option(&max_str, 'M', "max", "real", "Define the normed max value", "1.0"); 246 blc_program_add_option(&max_str, 'M', "max", "real", "Define the normed max value", "1.0");
247 blc_program_add_option(&str_neutral_value, 'N', "neutral_value", "real", "Define the normed neutral value", "0.5"); 247 blc_program_add_option(&str_neutral_value, 'N', "neutral_value", "real", "Define the normed neutral value", "0.5");
@@ -251,55 +251,61 @@ int main(int argc, char** argv){ @@ -251,55 +251,61 @@ int main(int argc, char** argv){
251 blc_program_init(&argc, &argv, blc_quit); 251 blc_program_init(&argc, &argv, blc_quit);
252 blc_command_forward_blc_channels(); 252 blc_command_forward_blc_channels();
253 253
254 - //This get back normal keyboard behavior after quitting 254 + //This get back normal keyboard behavior (blocking mode) after quitting
255 atexit(blc_set_back_stdin_mode); 255 atexit(blc_set_back_stdin_mode);
256 256
257 - if (strlen(str_quitting_key)!=1) EXIT_ON_ERROR("You can only have one quitting key. You propose %s", str_quitting_key);  
258 -  
259 if (strcmp(str_neutral_key, "escape")==0) neutral_key=27; //Escape 257 if (strcmp(str_neutral_key, "escape")==0) neutral_key=27; //Escape
260 - else if (strlen(str_neutral_key)!=1) EXIT_ON_ERROR("You can only have one neutral key. You propose %s", str_neutral_key); 258 + else if (strlen(str_neutral_key)!=1) EXIT_ON_ERROR("You can only have one neutral key. You propose '%s'", str_neutral_key);
261 else neutral_key=str_neutral_key[0]; 259 else neutral_key=str_neutral_key[0];
262 260
  261 + if (strcmp(str_quitting_key, "return")==0) quitting_key=10; //Escape
  262 + else if (strlen(str_quitting_key)!=1) EXIT_ON_ERROR("You can only have one quitting key. You propose '%s'", str_quitting_key);
  263 + else quitting_key=str_quitting_key[0];
  264 +
263 neutral_value=strtof(str_neutral_value, NULL); 265 neutral_value=strtof(str_neutral_value, NULL);
264 max_value=strtof(max_str, NULL); 266 max_value=strtof(max_str, NULL);
265 min_value=strtof(min_str, NULL); 267 min_value=strtof(min_str, NULL);
266 268
267 - quitting_key=str_quitting_key[0];  
268 -  
269 - if (key_nb_str) keys_nb=strtod(key_nb_str, NULL);  
270 - else if (key_list) keys_nb=strlen(key_list); 269 + if (key_nb_str && key_list) EXIT_ON_ERROR("You cannot precise size (-s) '%s' and key_list (-k) '%s' at the same time", key_nb_str, key_list);
  270 + else if (key_nb_str) keys_nb=strtod(key_nb_str, NULL);
  271 + else if (key_list) keys_nb=strlen(key_list);
271 else keys_nb=-1; 272 else keys_nb=-1;
272 273
273 - if (type_str) type=STRING_TO_UINT32(type_str);  
274 -  
275 - if ( blc_channel_get_info_with_name(&channel_info, channel_name)==-1){  
276 - if (key_list==NULL) {  
277 - key_list=(char *)"0123456789abcdef";  
278 - keys_nb=strlen(key_list);  
279 - if (type_str==NULL) type='UIN8'; //Default  
280 - }  
281 - }  
282 - else { 274 + // if the channel exist, we use it as porpeties
  275 + if (blc_channel_get_info_with_name(&channel_info, channel_name)!=-1){
283 if (type_str==NULL) type=channel_info.type; 276 if (type_str==NULL) type=channel_info.type;
284 else if (STRING_TO_UINT32(type_str)!=channel_info.type) EXIT_ON_CHANNEL_ERROR(&channel_info, "The requested type '%s' differ from the exisiting channel", type_str); 277 else if (STRING_TO_UINT32(type_str)!=channel_info.type) EXIT_ON_CHANNEL_ERROR(&channel_info, "The requested type '%s' differ from the exisiting channel", type_str);
285 if (keys_nb==-1) keys_nb=channel_info.total_length; 278 if (keys_nb==-1) keys_nb=channel_info.total_length;
286 else if (keys_nb!=channel_info.total_length) EXIT_ON_CHANNEL_ERROR(&channel_info, "number of keys(%d) differ from channel length (%d)", keys_nb, channel.total_length); 279 else if (keys_nb!=channel_info.total_length) EXIT_ON_CHANNEL_ERROR(&channel_info, "number of keys(%d) differ from channel length (%d)", keys_nb, channel.total_length);
287 } 280 }
288 281
289 - if (key_list==NULL){  
290 - key_list=MANY_ALLOCATIONS(keys_nb, char);  
291 - FOR(i, keys_nb){  
292 - if (i<10) key_list[i]=48+i; //01234567890  
293 - else if (i<36) key_list[i]=97+i-10; //abc...xyz  
294 - else if (i<62) key_list[i]=65+i-36; //ABC...XYZ  
295 - else if (i==62) key_list[i]='[';  
296 - else if (i==63) key_list[i]=']';  
297 - else EXIT_ON_ERROR("Too many keys. You have '%d' max is 64", keys_nb); 282 + if (key_list==NULL) {
  283 + if (keys_nb==-1){
  284 + key_list=(char *)"0123456789abcdef";
  285 + keys_nb=strlen(key_list);
  286 + }
  287 + else {
  288 + key_list=MANY_ALLOCATIONS(keys_nb, char);
  289 + FOR(i, keys_nb){
  290 + if (i<10) key_list[i]=48+i; //01234567890
  291 + else if (i<36) key_list[i]=97+i-10; //abc...xyz
  292 + else if (i<62) key_list[i]=65+i-36; //ABC...XYZ
  293 + else if (i==62) key_list[i]='[';
  294 + else if (i==63) key_list[i]=']';
  295 + else EXIT_ON_ERROR("Too many keys. You have '%d' max is 64", keys_nb);
  296 + }
298 } 297 }
299 } 298 }
300 299
301 - if (memchr(key_list, quitting_key, keys_nb)) EXIT_ON_ERROR("The quitting key '%c' is in your key list %*s, you need to select an other one with --quitting_key=...", quitting_key, keys_nb, quitting_key);  
302 - if (memchr(key_list, neutral_key, keys_nb)) EXIT_ON_ERROR("The neutral key '%c' is in your key list %*s, you need to select an other one with --neutral_key=...", quitting_key, keys_nb, neutral_key); 300 + if (type_str) type=STRING_TO_UINT32(type_str);
  301 + else type='UIN8'; //default type
  302 +
  303 +
  304 +
  305 +
  306 +
  307 + if (memchr(key_list, quitting_key, keys_nb)) EXIT_ON_ERROR("The quitting key '%c' is in your key list %.*s, you need to select an other one with --quitting_key=...", quitting_key, keys_nb, key_list);
  308 + if (memchr(key_list, neutral_key, keys_nb)) EXIT_ON_ERROR("The neutral key '%c' is in your key list %.*s, you need to select an other one with --neutral_key=...", neutral_key, keys_nb, key_list);
303 309
304 channel.create_or_open(channel_name, BLC_CHANNEL_WRITE, type, 'NDEF', 1, keys_nb); 310 channel.create_or_open(channel_name, BLC_CHANNEL_WRITE, type, 'NDEF', 1, keys_nb);
305 311
@@ -312,13 +318,13 @@ int main(int argc, char** argv){ @@ -312,13 +318,13 @@ int main(int argc, char** argv){
312 else { 318 else {
313 switch (type){ 319 switch (type){
314 case 'UIN8': 320 case 'UIN8':
315 - FOR(i, keys_nb) channel.uchars[i]=BLC_NORMED_FLOAT_TO_UCHAR(neutral_value);  
316 - break; 321 + FOR(i, keys_nb) channel.uchars[i]=BLC_NORMED_FLOAT_TO_UCHAR(neutral_value);
  322 + break;
317 case 'FL32': 323 case 'FL32':
318 - FOR(i, keys_nb) channel.floats[i]=neutral_value;  
319 - break; 324 + FOR(i, keys_nb) channel.floats[i]=neutral_value;
  325 + break;
320 default:EXIT_ON_ARRAY_ERROR(&channel, "Type not managed"); 326 default:EXIT_ON_ARRAY_ERROR(&channel, "Type not managed");
321 - break; 327 + break;
322 } 328 }
323 } 329 }
324 330
@@ -332,7 +338,7 @@ int main(int argc, char** argv){ @@ -332,7 +338,7 @@ int main(int argc, char** argv){
332 } 338 }
333 blc_set_stdin_non_blocking_mode(); 339 blc_set_stdin_non_blocking_mode();
334 340
335 - fprintf(stderr, "Waiting for one key in '%s'. Quitting with '%c'\n", key_list, quitting_key); 341 + fprintf(stderr, "Waiting for one key in '%.*s'. Quitting with '%s'\n", keys_nb, key_list, str_quitting_key);
336 342
337 //We pre calculate the answers 343 //We pre calculate the answers
338 max=min=key_list[0]; 344 max=min=key_list[0];
@@ -352,18 +358,18 @@ int main(int argc, char** argv){ @@ -352,18 +358,18 @@ int main(int argc, char** argv){
352 channel.publish(); 358 channel.publish();
353 switch (channel.type){ 359 switch (channel.type){
354 case 'UIN8': 360 case 'UIN8':
355 - if (step_size_str) uchar_step_size=strtod(step_size_str, NULL);  
356 - if (toggle_mode) loop_toggle_uchar();  
357 - else loop_uchar();  
358 - break; 361 + if (step_size_str) uchar_step_size=strtod(step_size_str, NULL);
  362 + if (toggle_mode) loop_toggle_uchar();
  363 + else loop_uchar();
  364 + break;
359 case 'FL32': 365 case 'FL32':
360 - if (step_size_str) float_step_size=strtof(step_size_str, NULL);  
361 - if (toggle_mode) loop_toggle_float();  
362 - else loop_float();  
363 - break; 366 + if (step_size_str) float_step_size=strtof(step_size_str, NULL);
  367 + if (toggle_mode) loop_toggle_float();
  368 + else loop_float();
  369 + break;
364 default: 370 default:
365 - EXIT_ON_ARRAY_ERROR(&channel, "The type is not managed.");  
366 - break; 371 + EXIT_ON_ARRAY_ERROR(&channel, "The type is not managed.");
  372 + break;
367 } 373 }
368 return EXIT_SUCCESS; 374 return EXIT_SUCCESS;
369 } 375 }