Change in osmo-mgw[master]: add osmo-mgw --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
Fri Jun 19 21:19:19 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/18926 )


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

add osmo-mgw --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: Ia988ea1c3f5169bdb4d21f2f05933665711cfcbf
---
M src/osmo-mgw/mgw_main.c
1 file changed, 12 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/26/18926/1

diff --git a/src/osmo-mgw/mgw_main.c b/src/osmo-mgw/mgw_main.c
index 99e2499..6ca1800 100644
--- a/src/osmo-mgw/mgw_main.c
+++ b/src/osmo-mgw/mgw_main.c
@@ -98,18 +98,21 @@
 	printf(" -s --disable-color\n");
 	printf(" -D --daemonize Fork the process into a background daemon\n");
 	printf(" -V --version Print the version number\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'},
 			{"config-file", 1, 0, 'c'},
 			{"daemonize", 0, 0, 'D'},
 			{"version", 0, 0, 'V'},
 			{"disable-color", 0, 0, 's'},
+			{"vty-ref-xml", 0, &long_option, 1},
 			{0, 0, 0, 0},
 		};
 
@@ -123,6 +126,15 @@
 			print_help();
 			exit(0);
 			break;
+		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 'c':
 			config_file = talloc_strdup(tall_bsc_ctx, optarg);
 			break;

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ia988ea1c3f5169bdb4d21f2f05933665711cfcbf
Gerrit-Change-Number: 18926
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200619/e8ae1b94/attachment.htm>


More information about the gerrit-log mailing list