diff options
Diffstat (limited to 'src/ck.c')
-rw-r--r-- | src/ck.c | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -26,30 +26,24 @@ int main(int argc, char *argv[]) { if (opt.action != CKA_INIT) { if (!db_exists(&opt)) { printf("ck is not initialized in %s.\nRun ck init first.\n", opt.confDir); + free_user_opt(&opt); return 1; } if (!config_file_parse(&conf, &opt)) { + free_user_opt(&opt); return 1; } } - int ok; - switch(opt.action) { -#define X(ACTION) \ - case CKA_##ACTION: \ - ok = run_##ACTION(&opt, &conf); \ - break; - CK_ACTIONS -#undef X - } + /* Run action and print results */ switch(opt.action) { -#define X(ACTION) \ - case CKA_##ACTION: \ - print_##ACTION##_result(ok); \ +#define X(ACTION) \ + case CKA_##ACTION: \ + print_##ACTION##_result(run_##ACTION(&opt, &conf)); \ break; CK_ACTIONS -#undef X +#undef X } free_user_opt(&opt); return 0; |