diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -41,6 +41,7 @@ void usage() { " -4 Include chars from the forth most used scripts in the world\n" "\n" " -h,--help Print this help text\n" + " -d,--debug Enable debug mode (prints entire character pool)\n" ); } @@ -48,12 +49,14 @@ void usage() { int main(int argc, char* argv[]) { struct timespec ts; // Timespec for seeding rng unsigned int count; // Number of chars to choose from + int debug; // Debug mode switch int len; // Password length int i; // Arg index unsigned long seed; // Seed for the RNG (current seconds * nanoseconds) unsigned int chars[4096]; // Uint array to hold international chars // Initialize + debug = 0; count = 0; len = 32; i = 1; @@ -95,6 +98,9 @@ int main(int argc, char* argv[]) { usage(); return 0; + } else if(strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--debug") == 0) { + debug = 1; + } else { // If we reach this block, the user specified a custom length (or // fatfingered something). Test for ability to convert from str to int @@ -114,6 +120,9 @@ int main(int argc, char* argv[]) { if(chars[0] == '\0') count += i18n_cat_ascii(chars); + if(debug) + i18n_dump_arr(chars); + // Get the random data seed clock_gettime(CLOCK_REALTIME, &ts); seed = ts.tv_sec + ts.tv_nsec; |