From e7dcd868c01e02ed85b4cb34a1a65d56b3853117 Mon Sep 17 00:00:00 2001 From: Kim Holviala Date: Fri, 1 Jan 2016 11:52:05 +0200 Subject: [PATCH] Added option -v to display version number and build date --- README | 1 + options.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README b/README index f679205..b921ca6 100644 --- a/README +++ b/README @@ -43,6 +43,7 @@ Command line options: -nr Disable root user checking (for debugging) -d Debug to syslog (not for production use) + -v Display version number and build date -b Display the BSD license -? Display this help diff --git a/options.c b/options.c index e0d6123..5cb38e7 100644 --- a/options.c +++ b/options.c @@ -97,7 +97,7 @@ void parse_args(state *st, int argc, char *argv[]) int opt; /* Parse args */ - while ((opt = getopt(argc, argv, "h:p:r:t:g:a:c:u:m:l:w:o:s:i:k:f:e:R:D:L:A:P:n:db?-")) != ERROR) { + while ((opt = getopt(argc, argv, "h:p:r:t:g:a:c:u:m:l:w:o:s:i:k:f:e:R:D:L:A:P:n:dbv?-")) != ERROR) { switch(opt) { case 'h': sstrlcpy(st->server_host, optarg); break; case 'p': st->server_port = atoi(optarg); break; @@ -145,6 +145,11 @@ void parse_args(state *st, int argc, char *argv[]) case 'd': st->debug = TRUE; break; case 'b': puts(license); exit(EXIT_SUCCESS); + + case 'v': + printf("%s/%s \"%s\" (built %s)\n", SERVER_SOFTWARE, VERSION, CODENAME, __DATE__); + exit(EXIT_SUCCESS); + default : puts(readme); exit(EXIT_SUCCESS); } }