aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-06-19 03:46:02 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2020-06-19 23:00:28 +0200
commit8a234460c0cee5e250b3f562c7c944efc8a84fca (patch)
tree4895dc36bac69e31870eba6703e4da2e56e33fe4
parent9aac5c2d215d6309445801d1f3cd954933942615 (diff)
add osmo-msc --vty-ref-xml: dump VTY ref XML to stdout
Add only a long option to not clutter the cmdline namespace. To add a long option without a short letter is slightly complex: use the 'flag' and 'val' mechanism as in 'man 3 getopt' to write an option index to long_option. Depends: Ic74bbdb6dc5ea05f03c791cc70184861e39cd492 (libosmocore) Change-Id: I9146d5a44427509265420f52ae6540ad93eb14fc
-rw-r--r--src/osmo-msc/msc_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index cf1e5043d..c04ccddb7 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -131,12 +131,14 @@ static void print_help()
printf(" -V --version Print the version of OsmoMSC.\n");
printf(" -e --log-level number Set a global loglevel.\n");
printf(" -M --mncc-sock-path PATH Disable built-in MNCC handler and offer socket.\n");
+ printf(" --vty-ref-xml Generate the VTY reference XML output and exit.\n");
}
static void handle_options(int argc, char **argv)
{
while (1) {
int option_index = 0, c;
+ static int long_option = 0;
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"debug", 1, 0, 'd'},
@@ -149,6 +151,7 @@ static void handle_options(int argc, char **argv)
{"log-level", 1, 0, 'e'},
{"mncc-sock-path", 1, 0, 'M'},
{"no-dbcounter", 0, 0, 'C'}, /* deprecated */
+ {"vty-ref-xml", 0, &long_option, 1},
{0, 0, 0, 0}
};
@@ -162,6 +165,15 @@ static void handle_options(int argc, char **argv)
print_usage();
print_help();
exit(0);
+ case 0:
+ switch (long_option) {
+ case 1:
+ vty_dump_xml_ref(stdout);
+ exit(0);
+ default:
+ fprintf(stderr, "error parsing cmdline options\n");
+ exit(2);
+ }
case 's':
log_set_use_color(osmo_stderr_target, 0);
break;