aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-01-13 23:45:15 +1100
committerNicholas Tay <nick@windblume.net>2022-01-13 23:45:15 +1100
commitfb4cc1accdf41204978beef6f7c9e2bdf4acbb54 (patch)
treee0264e1adf59d6c8581ff5e845f7fe75d11e49a1
parent3ab3302c51960212b3ed51d92da140e8f93105ce (diff)
downloadpassgen-fb4cc1accdf41204978beef6f7c9e2bdf4acbb54.tar.gz
passgen-fb4cc1accdf41204978beef6f7c9e2bdf4acbb54.tar.bz2
passgen-fb4cc1accdf41204978beef6f7c9e2bdf4acbb54.zip
Add help option
-rw-r--r--passgen.c13
1 files changed, 13 insertions, 0 deletions
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 <grammar>\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', <triplets><symbols><numbers>.\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);