commit 56fdb92d3c609bfe29de12cc4a6ecd2ef03c920f from: Alexander Arkhipov date: Sun Aug 21 17:25:19 2022 UTC cleanup commit - e9952e5924b7a0cb62697d5a008476ab4bd6dd3f commit + 56fdb92d3c609bfe29de12cc4a6ecd2ef03c920f blob - bc8333b2af521341546986741038fce75ff0b706 blob + f447d1bc8ffad6facb7f8424555b091cd0781764 --- gpass.c +++ gpass.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -13,7 +14,7 @@ #define PREFIX "/usr/local" #endif -char *pgen, *dictname = NULL; +char *dictname = NULL; int plen = 70, nlines = 0, npass = 1; FILE *dictfp; @@ -22,7 +23,7 @@ FILE *dictfp; int usage(void) { - fprintf(stderr, "%s [-d dict] [-e bits] [-n count]\n", pgen); + fprintf(stderr, "%s [-d dict] [-e bits] [-n count]\n", getprogname()); exit(EXIT_FAILURE); } @@ -55,9 +56,9 @@ gen(void) int main(int argc, char *argv[]) { - pgen = argv[0]; if (sodium_init() < 0) err(1, "libsodium"); + int c; while ((c = getopt(argc, argv, "d:e:n:")) != -1) { switch (c) { @@ -92,4 +93,6 @@ main(int argc, char *argv[]) for (int i = 0; i < npass; i++) gen(); fclose(dictfp); + + return 0; }