From 262b5196cfead8fc8eaa15d6cbcf8011e647f17c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 26 Dec 2019 12:30:12 +0100 Subject: [PATCH] wg: include tools version Signed-off-by: Jason A. Donenfeld --- src/version.h | 1 + src/wg.c | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 src/version.h diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..3b78506 --- /dev/null +++ b/src/version.h @@ -0,0 +1 @@ +#define WIREGUARD_TOOLS_VERSION "0.0.20191219" diff --git a/src/wg.c b/src/wg.c index 7b5d3af..dc6dda4 100644 --- a/src/wg.c +++ b/src/wg.c @@ -8,6 +8,7 @@ #include #include "subcommands.h" +#include "version.h" const char *PROG_NAME; @@ -40,6 +41,10 @@ int main(int argc, char *argv[]) { PROG_NAME = argv[0]; + if (argc == 2 && (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version") || !strcmp(argv[1], "version"))) { + printf("wireguard-tools v%s - https://git.zx2c4.com/wireguard-tools/\n", WIREGUARD_TOOLS_VERSION); + return 0; + } if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || !strcmp(argv[1], "help"))) { show_usage(stdout); return 0;