From 034b1279367fde005334fe3e3002a9c44d4d2360 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 26 Aug 2024 23:35:44 +0200 Subject: Support passing multiple secrets on the CLI --- src/main.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 3b9ba2b..545d05d 100644 --- a/src/main.c +++ b/src/main.c @@ -30,7 +30,7 @@ static noreturn void usage(const char *argv0) { fprintf(stderr, - "Usage: %s [-d digits] [-p period] [secret]\n" + "Usage: %s [-d digits] [-p period] [secret ...]\n" " %s -h\n", argv0, argv0); exit(EXIT_FAILURE); @@ -93,16 +93,10 @@ main(int argc, char **argv) argc -= optind; argv += optind; - switch (argc) { - case 0: + if (argc == 0) process_stdin(); - break; - case 1: - process(argv[0], strlen(argv[0])); - break; - default: - usage(argv[-optind]); - } + else for (int i = 0; i < argc; i++) + process(argv[i], strlen(argv[i])); return EXIT_SUCCESS; } -- cgit v1.2.3