aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-08-26 23:35:44 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-08-26 23:35:44 +0200
commit034b1279367fde005334fe3e3002a9c44d4d2360 (patch)
tree19c834bc1fd7940e2a150cdf89eae2163c89e979 /src
parentddff1b0ce695e714df6063264ec95244b7aa4b72 (diff)
Support passing multiple secrets on the CLI
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
1 files changed, 4 insertions, 10 deletions
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;
}