HS 2.0 server: Command line option to fetch the version information

This can be used to report automatically generated version strings from
the SPP server.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-01-23 12:34:57 +02:00 committed by Jouni Malinen
parent 2d1762fa4a
commit 59c6930641
2 changed files with 15 additions and 1 deletions

View file

@ -21,6 +21,16 @@ LIBS += -lsqlite3
# Using glibc < 2.17 requires -lrt for clock_gettime() # Using glibc < 2.17 requires -lrt for clock_gettime()
LIBS += -lrt 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=spp_server.o
OBJS += hs20_spp_server.o OBJS += hs20_spp_server.o
OBJS += ../../src/utils/xml-utils.o OBJS += ../../src/utils/xml-utils.o

View file

@ -11,6 +11,7 @@
#include <sqlite3.h> #include <sqlite3.h>
#include "common.h" #include "common.h"
#include "common/version.h"
#include "xml-utils.h" #include "xml-utils.h"
#include "spp_server.h" #include "spp_server.h"
@ -158,7 +159,7 @@ int main(int argc, char *argv[])
os_memset(&ctx, 0, sizeof(ctx)); os_memset(&ctx, 0, sizeof(ctx));
for (;;) { for (;;) {
int c = getopt(argc, argv, "f:r:"); int c = getopt(argc, argv, "f:r:v");
if (c < 0) if (c < 0)
break; break;
switch (c) { switch (c) {
@ -174,6 +175,9 @@ int main(int argc, char *argv[])
case 'r': case 'r':
ctx.root_dir = optarg; ctx.root_dir = optarg;
break; break;
case 'v':
printf("hs20_spp_server v" VERSION_STR "\n");
return 0;
default: default:
usage(); usage();
return -1; return -1;