Change in osmo-bsc[master]: add osmo-bsc --vty-ref-xml: dump VTY ref XML to stdout

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 16 10:16:30 UTC 2020


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18347 )

Change subject: add osmo-bsc --vty-ref-xml: dump VTY ref XML to stdout
......................................................................

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
---
M src/osmo-bsc/osmo_bsc_main.c
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 9ddbe35..0e5b4e6 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -104,12 +104,14 @@
 	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 @@
 			{"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 @@
 			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;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18347
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I316efedb2c1652791434ecf14a1e261367cd2fb7
Gerrit-Change-Number: 18347
Gerrit-PatchSet: 6
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200616/9491129f/attachment.htm>


More information about the gerrit-log mailing list