diff options
author | Nicholas Tay <nick@windblume.net> | 2021-12-01 00:17:06 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2021-12-01 00:17:06 +1100 |
commit | c7f83dc80ac64ab340ec59dfcd75f286c99e95c0 (patch) | |
tree | f2099e3e840ac8182767c9ea8a12c31d95771790 /passgen.c | |
parent | 11fdab7053bcf02d769b5fec7cd2b1d41b3846d1 (diff) | |
download | passgen-c7f83dc80ac64ab340ec59dfcd75f286c99e95c0.tar.gz passgen-c7f83dc80ac64ab340ec59dfcd75f286c99e95c0.tar.bz2 passgen-c7f83dc80ac64ab340ec59dfcd75f286c99e95c0.zip |
Take a single argument as a grammar
Diffstat (limited to 'passgen.c')
-rw-r--r-- | passgen.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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]);
|