]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg: include tools version
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 26 Dec 2019 11:30:12 +0000 (12:30 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 26 Dec 2019 12:10:42 +0000 (13:10 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/version.h [new file with mode: 0644]
src/wg.c

diff --git a/src/version.h b/src/version.h
new file mode 100644 (file)
index 0000000..3b78506
--- /dev/null
@@ -0,0 +1 @@
+#define WIREGUARD_TOOLS_VERSION "0.0.20191219"
index 7b5d3af6d02da179345f68c3e69b611d6b4cb7ef..dc6dda4b4133c3ebc79570c3824b8c2ca9a917b5 100644 (file)
--- a/src/wg.c
+++ b/src/wg.c
@@ -8,6 +8,7 @@
 #include <string.h>
 
 #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;