aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-05-14 17:46:26 +0200
committerneels <nhofmeyr@sysmocom.de>2020-06-16 10:16:30 +0000
commit77c330d57c33e98f6ddc587177b7bd331ff02515 (patch)
tree4f23107521e6cc5335a1817cbef0ed744de52bf0
parentb5ccf09fc4042c7fb1fdaaa6263961c40b32564e (diff)
add osmo-bsc --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: I316efedb2c1652791434ecf14a1e261367cd2fb7
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 9ddbe3577..0e5b4e6fa 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -104,12 +104,14 @@ static void print_help()
printf(" -e --log-level number Set a global loglevel.\n");
printf(" -r --rf-ctl NAME A unix domain socket to listen for cmds.\n");
printf(" -t --testmode A special mode to provoke failures at the MSC.\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'},
@@ -122,6 +124,7 @@ static void handle_options(int argc, char **argv)
{"log-level", 1, 0, 'e'},
{"rf-ctl", 1, 0, 'r'},
{"testmode", 0, 0, 't'},
+ {"vty-ref-xml", 0, &long_option, 1},
{0, 0, 0, 0}
};
@@ -135,6 +138,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;