Skip to content

Commit

Permalink
issue #44, show version number
Browse files Browse the repository at this point in the history
Adriaan implemented it and kept it quit :) but thanks dude!

Merge branch 'add-version' of https://github.com/adriaandegroot/tlspool into enhancements
  • Loading branch information
vanrein committed Mar 26, 2019
2 parents 864d65d + e9f83a8 commit bf6b007
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Expand Up @@ -38,6 +38,7 @@ set(tlspool_SRC
)

add_executable(tlspool-daemon ${tlspool_SRC})
target_compile_definitions(tlspool-daemon PRIVATE -DTLSPOOL_VERSION="${TLSPool_VERSION}")
target_link_libraries(tlspool-daemon
${BDB_LIBRARY}
${GNUTLS_LIBRARY}
Expand Down
8 changes: 7 additions & 1 deletion src/daemon.c
Expand Up @@ -14,6 +14,7 @@

#include "manage.h"

static const char version_string[] = TLSPOOL_VERSION; /* defined as compile-time argument */

void process_hangup (int hangupsignal) {
tlog (TLOG_DAEMON, LOG_NOTICE, "Received signal %d as a hangup request");
Expand Down Expand Up @@ -75,8 +76,13 @@ int main (int argc, char *argv []) {
* Cmdline argument parsing
*/
while (parsing) {
int opt = getopt (argc, argv, "kc:");
int opt = getopt (argc, argv, "Vkc:");
switch (opt) {
case 'V':
fputs (version_string, stdout);
fputc ('\n', stdout);
exit (0);
break;
case 'k':
if (kill_competition) {
fprintf (stderr, "You can only flag kill-the-competition once\n");
Expand Down

0 comments on commit bf6b007

Please sign in to comment.