]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0 server: Command line option to fetch the version information
authorJouni Malinen <jouni@codeaurora.org>
Wed, 23 Jan 2019 10:34:57 +0000 (12:34 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 23 Jan 2019 22:20:44 +0000 (00:20 +0200)
This can be used to report automatically generated version strings from
the SPP server.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hs20/server/Makefile
hs20/server/hs20_spp_server.c

index 248ed5cccf93ca15fee3848100b0ddd0948eed50..9b73727960284eb52eeb0b31e75c5e32377fcfe7 100644 (file)
@@ -21,6 +21,16 @@ LIBS += -lsqlite3
 # Using glibc < 2.17 requires -lrt for clock_gettime()
 LIBS += -lrt
 
+ifndef CONFIG_NO_GITVER
+# Add VERSION_STR postfix for builds from a git repository
+ifeq ($(wildcard ../../.git),../../.git)
+GITVER := $(shell git describe --dirty=+)
+ifneq ($(GITVER),)
+CFLAGS += -DGIT_VERSION_STR_POSTFIX=\"-$(GITVER)\"
+endif
+endif
+endif
+
 OBJS=spp_server.o
 OBJS += hs20_spp_server.o
 OBJS += ../../src/utils/xml-utils.o
index f8e477bec47b50d8932180cc6fbc43eb054ea0e3..6c74f541d539c1e1dcabb9c9bd095906812f908a 100644 (file)
@@ -11,6 +11,7 @@
 #include <sqlite3.h>
 
 #include "common.h"
+#include "common/version.h"
 #include "xml-utils.h"
 #include "spp_server.h"
 
@@ -158,7 +159,7 @@ int main(int argc, char *argv[])
 
        os_memset(&ctx, 0, sizeof(ctx));
        for (;;) {
-               int c = getopt(argc, argv, "f:r:");
+               int c = getopt(argc, argv, "f:r:v");
                if (c < 0)
                        break;
                switch (c) {
@@ -174,6 +175,9 @@ int main(int argc, char *argv[])
                case 'r':
                        ctx.root_dir = optarg;
                        break;
+               case 'v':
+                       printf("hs20_spp_server v" VERSION_STR "\n");
+                       return 0;
                default:
                        usage();
                        return -1;