summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2018-10-16 17:02:26 +0200
committerOliver Smith <osmith@sysmocom.de>2018-10-16 17:02:55 +0200
commitd9c059e92ac7d09959a6d53510a1150658174b69 (patch)
tree58cd6d9d26f345eaa1a555f1168624db4c794c77
parentf0c2b31df9941fb9f54c9bff61527462b7def77d (diff)
Add --version cmdline option
-rw-r--r--src/main.c8
1 files changed, 7 insertions, 1 deletions
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;
}
}
}