288 {
289 struct gengetopt_args_info args_info;
292
293 int rc = EXIT_FAILURE;
294
295 if (cmdline_parser(argc,
argv, &args_info) != 0) {
296 goto main_exit;
297 }
298
301 fprintf(stderr, "Failed to initialize libykyh\n");
302 goto main_exit;
303 }
304
307 fprintf(stderr,
"Unable to connect: %s\n",
ykyh_strerror(ykyhrc));
308 goto main_exit;
309 }
310
311 bool result = false;
312 switch (args_info.action_arg) {
313 case action_arg_delete:
314 result = delete_credential(
state, args_info.name_arg);
315 break;
316
317 case action_arg_list:
318 result = list_credentials(
state);
319 break;
320
321 case action_arg_put:
322 result = put_credential(
state, args_info.name_arg,
323 args_info.derivation_password_arg,
324 args_info.enckey_arg, args_info.mackey_arg,
325 args_info.password_arg, args_info.touch_arg);
326 break;
327
328 case action_arg_reset:
330 break;
331
332 case action_arg_version:
334 break;
335
336 case action__NULL:
337 fprintf(stderr, "No action given, nothing to do\n");
338 break;
339 }
340
341 if (result == true) {
343 }
344
345main_exit:
346
348
350}
bool get_version(ykyh_state *state)
bool reset_device(ykyh_state *state)
ykyh_rc ykyh_done(ykyh_state *state)
ykyh_rc ykyh_connect(ykyh_state *state, const char *wanted)
ykyh_rc ykyh_init(ykyh_state **state, int verbose)