diff options
-rw-r--r-- | src/npass/npass.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/npass/npass.c b/src/npass/npass.c index 0b5f792..869b6eb 100644 --- a/src/npass/npass.c +++ b/src/npass/npass.c @@ -202,15 +202,12 @@ out_free_pass: int main(int argc, char *argv[]) { int r = 0; + pass_store_t store_type; - if (!--argc) { - print_usage(); - exit(EXIT_FAILURE); - } ++argv; - - - if (!strcmp("help", *argv)) { + if (!--argc) { + r = ls(NULL, 0, NULL); + } else if (!strcmp("help", *argv)) { print_usage(); } else if (!strcmp("init", *argv)) { if (argc != 2) @@ -243,7 +240,19 @@ int main(int argc, char *argv[]) r = gen(argc, argv); } else if (argc == 1){ - r = cat(*argv); + store_type = pass_store_type(*argv); + + switch (store_type) { + case PASS_STORE_DIR: + r = ls(*argv, 0, NULL); + break; + case PASS_STORE_ENC: + r = cat(*argv); + break; + default: + invalid_usage_err_ret(); + break; + } } else { invalid_usage_err_ret(); } |