From 381c99723cf3d76c8bb7a7e2fb5fb3f26bf7804d Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Wed, 22 Mar 2023 21:27:52 +1100 Subject: Add version to app itself --- passgen.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/passgen.c b/passgen.c index f4112af..d8b2201 100644 --- a/passgen.c +++ b/passgen.c @@ -5,6 +5,8 @@ #include #include +#define VERSION "0.1.1" + #if defined (__linux__) \ || defined (__APPLE__) \ || defined (__FreeBSD__) \ @@ -140,7 +142,7 @@ int main(int argc, char *argv[]) if (argc == 2) { if (strcmp(argv[1], "--help") == 0) { printf("\ -passgen - a small, customisable password generator\n\ +passgen v"VERSION" - a small, customisable password generator\n\ Usage: %s\n\ %s \n\ %s <#triplets ('Cvc')> <#symbols> <#numbers>\n\ @@ -155,7 +157,10 @@ Compile-time options (edit `config.h` to customise!):\n\ printf(" - '%c' => \"%s\"\n", classes[i].c, classes[i].letters); } return 0; - } + } else if (strcmp(argv[1], "--version") == 0) { + printf("passgen v"VERSION"\n"); + return 0; + } /* Take first argument as the grammar */ grammar = argv[1]; grammar_size = strlen(grammar); -- cgit