aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2021-12-01 00:17:06 +1100
committerNicholas Tay <nick@windblume.net>2021-12-01 00:17:06 +1100
commitc7f83dc80ac64ab340ec59dfcd75f286c99e95c0 (patch)
treef2099e3e840ac8182767c9ea8a12c31d95771790
parent11fdab7053bcf02d769b5fec7cd2b1d41b3846d1 (diff)
downloadpassgen-c7f83dc80ac64ab340ec59dfcd75f286c99e95c0.tar.gz
passgen-c7f83dc80ac64ab340ec59dfcd75f286c99e95c0.tar.bz2
passgen-c7f83dc80ac64ab340ec59dfcd75f286c99e95c0.zip
Take a single argument as a grammar
-rw-r--r--passgen.c7
1 files changed, 6 insertions, 1 deletions
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]);