From fb4cc1accdf41204978beef6f7c9e2bdf4acbb54 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Thu, 13 Jan 2022 23:45:15 +1100 Subject: Add help option --- passgen.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/passgen.c b/passgen.c index e759766..5039fe4 100644 --- a/passgen.c +++ b/passgen.c @@ -121,6 +121,19 @@ int main(int argc, char *argv[]) char *password = password_buf; if (argc == 2) { + if (strcmp(argv[1], "--help") == 0) { + printf("\ +passgen - a small, customisable password generator\n\ +Usage: %s\n\ + %s \n\ + %s <#triplets ('Cvc')> <#symbols> <#numbers>\n\ +Hints:\n\ + - No arguments generates with the default grammar.\n\ + - If three numbers are provided, a password will be generated in the 'standard form', .\n\ +Compile-time options:\n\ + - Default grammar: %s\n", argv[0], argv[0], argv[0], grammar_buf); + return 0; + } /* Take first argument as the grammar */ grammar = argv[1]; grammar_size = strlen(grammar); -- cgit