From c7f83dc80ac64ab340ec59dfcd75f286c99e95c0 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Wed, 1 Dec 2021 00:17:06 +1100 Subject: Take a single argument as a grammar --- passgen.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'passgen.c') diff --git a/passgen.c b/passgen.c index 202809b..0139292 100644 --- a/passgen.c +++ b/passgen.c @@ -7,6 +7,7 @@ #define DEFAULT_GRAMMAR "Cvccvc!##" // i, o excluded due to potentially confusing 1/l/i + 0/o +// y included as a vowel because it kinda is one #define VOWELS "aeuy" #define CONSONANTS "bcdfghkmnprstvwxz" #define NUMBERS "1234567890" @@ -17,7 +18,11 @@ int main(int argc, char *argv[]) char *grammar = DEFAULT_GRAMMAR; int grammar_size = sizeof(DEFAULT_GRAMMAR)-1; - if (argc == 4) { + if (argc == 2) { + // Take first argument as the grammar + grammar = argv[1]; + grammar_size = strlen(grammar); + } else if (argc == 4) { // Take arguments as triplets, specials, numbers // atoi might be scuffed but so be it (it just goes = 0 if invalid input) int triplets = atoi(argv[1]); -- cgit