diff options
author | Oliver Smith <osmith@sysmocom.de> | 2018-10-16 17:02:26 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2018-10-16 17:02:55 +0200 |
commit | d9c059e92ac7d09959a6d53510a1150658174b69 (patch) | |
tree | 58cd6d9d26f345eaa1a555f1168624db4c794c77 | |
parent | f0c2b31df9941fb9f54c9bff61527462b7def77d (diff) |
Add --version cmdline option
Related: OS#3577
Change-Id: Ibdda54acddde0ac03e202286736d56b6fa51a365
-rw-r--r-- | src/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; } } } |