From d9c059e92ac7d09959a6d53510a1150658174b69 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 16 Oct 2018 17:02:26 +0200 Subject: Add --version cmdline option Related: OS#3577 Change-Id: Ibdda54acddde0ac03e202286736d56b6fa51a365 --- src/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 560995e..0661498 100644 --- a/src/main.c +++ b/src/main.c @@ -81,6 +81,7 @@ static void print_help(void) printf("OsmoSIPcon: MNCC to SIP bridge\n"); printf(" -h --help\tthis text\n"); printf(" -c --config-file NAME\tThe config file to use [%s]\n", config_file); + printf(" -V --version\tPrint the version number\n"); } static void handle_options(int argc, char **argv) @@ -90,10 +91,11 @@ static void handle_options(int argc, char **argv) static struct option long_options[] = { {"help", 0, 0, 'h'}, {"config-file", 1, 0, 'c'}, + {"version", 0, 0, 'V' }, {NULL, 0, 0, 0} }; - c = getopt_long(argc, argv, "hc:", + c = getopt_long(argc, argv, "hc:V", long_options, &option_index); if (c == -1) break; @@ -105,6 +107,10 @@ static void handle_options(int argc, char **argv) case 'c': config_file = optarg; break; + case 'V': + print_version(1); + exit(EXIT_SUCCESS); + break; } } } -- cgit v1.2.3