From: Jouni Malinen Date: Wed, 23 Jan 2019 10:34:57 +0000 (+0200) Subject: HS 2.0 server: Command line option to fetch the version information X-Git-Tag: hostap_2_8~514 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59c6930641cb47cf58345975687be94bb806a2a4;p=thirdparty%2Fhostap.git 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 --- diff --git a/hs20/server/Makefile b/hs20/server/Makefile index 248ed5ccc..9b7372796 100644 --- a/hs20/server/Makefile +++ b/hs20/server/Makefile @@ -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 diff --git a/hs20/server/hs20_spp_server.c b/hs20/server/hs20_spp_server.c index f8e477bec..6c74f541d 100644 --- a/hs20/server/hs20_spp_server.c +++ b/hs20/server/hs20_spp_server.c @@ -11,6 +11,7 @@ #include #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;