aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2018-10-16 17:09:18 +0200
committerHarald Welte <laforge@gnumonks.org>2018-10-21 12:36:05 +0000
commite64f0ef1f6a5cca0c77dfb5966b295aa37202e5e (patch)
treea8a765c7d0e83defe08fc9078c50a113c46a2724
parente90b1977c8e20dbdecef4ebc6fc674604a7bb447 (diff)
gtphub: Add --version cmdline option
-rw-r--r--src/gprs/gtphub_main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gprs/gtphub_main.c b/src/gprs/gtphub_main.c
index a1a2c1d..f824016 100644
--- a/src/gprs/gtphub_main.c
+++ b/src/gprs/gtphub_main.c
@@ -238,6 +238,7 @@ static void print_help(struct cmdline_cfg *ccfg)
printf(" -e,--log-level <nr> Set a global log level.\n");
printf(" -r,--restart-file <path> File for counting restarts [%s].\n",
ccfg->restart_counter_file);
+ printf(" -V,--version Print the version number.\n");
}
static void list_categories(void)
@@ -265,10 +266,11 @@ static void handle_options(struct cmdline_cfg *ccfg, int argc, char **argv)
{"timestamp", 0, 0, 'T'},
{"log-level", 1, 0, 'e'},
{"restart-file", 1, 0, 'r'},
+ { "version", 0, 0, 'V' },
{NULL, 0, 0, 0}
};
- c = getopt_long(argc, argv, "hd:Dc:sTe:r:",
+ c = getopt_long(argc, argv, "hd:Dc:sTe:r:V",
long_options, &option_index);
if (c == -1) {
if (optind < argc) {
@@ -310,6 +312,10 @@ static void handle_options(struct cmdline_cfg *ccfg, int argc, char **argv)
case 'r':
ccfg->restart_counter_file = optarg;
break;
+ case 'V':
+ print_version(1);
+ exit(EXIT_SUCCESS);
+ break;
default:
LOGP(DGTPHUB, LOGL_FATAL, "Invalid command line argument, abort.\n");
exit(1);