osmo-e1d: Add the usual '-V' / '--version' command line argument

Change-Id: Ie2d79c44e580ffa6555f87b969206047ffb7eb6f
This commit is contained in:
Harald Welte 2022-11-03 10:18:04 +01:00
parent 81546e6773
commit 7f204ac42a
1 changed files with 7 additions and 1 deletions

View File

@ -100,6 +100,7 @@ static void print_help(void)
{
printf(" Some useful help...\n");
printf(" -h --help This text.\n");
printf(" -V --version Print the version of osmo-e1d.\n");
printf(" -d --debug option --debug=DE1D:DXFR enable debugging.\n");
printf(" -c --config-file filename The config file to use.\n");
}
@ -110,12 +111,13 @@ static void handle_options(int argc, char **argv)
int option_index = 0, c;
static const struct option long_options[] = {
{"help", 0, 0, 'h'},
{"version", 0, 0, 'V'},
{"debug", 1, 0, 'd'},
{"config-file", 1, 0, 'c'},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "hd:c:", long_options, &option_index);
c = getopt_long(argc, argv, "hVd:c:", long_options, &option_index);
if (c == -1)
break;
@ -124,6 +126,10 @@ static void handle_options(int argc, char **argv)
print_help();
exit(0);
break;
case 'V':
print_version(1);
exit(0);
break;
case 'd':
log_parse_category_mask(osmo_stderr_target, optarg);
break;