diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-08-26 23:35:44 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-26 23:35:44 +0200 |
commit | 034b1279367fde005334fe3e3002a9c44d4d2360 (patch) | |
tree | 19c834bc1fd7940e2a150cdf89eae2163c89e979 /src | |
parent | ddff1b0ce695e714df6063264ec95244b7aa4b72 (diff) |
Support passing multiple secrets on the CLI
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -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; } |