Change in libosmocore[master]: vty: print program specific attributes in the XML reference

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/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Sep 20 09:57:45 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/19668 )

Change subject: vty: print program specific attributes in the XML reference
......................................................................

vty: print program specific attributes in the XML reference

Change-Id: I1f35368ba9178e1454f2e3ddfcad9d96576143ef
Related: SYS#4937
---
M src/vty/command.c
1 file changed, 26 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/vty/command.c b/src/vty/command.c
index 722b3e0..bad2688 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -628,11 +628,36 @@
 static int vty_dump_element(struct cmd_element *cmd, print_func_t print_func, void *data, const char *newline)
 {
 	char *xml_string = xml_escape(cmd->string);
+	unsigned int i;
 
 	print_func(data, "    <command id='%s'>%s", xml_string, newline);
+
+	/* Print application specific attributes and their description */
+	if (cmd->usrattr != 0x00) { /* ... if at least one flag is set */
+		print_func(data, "      <attributes scope='application'>%s", newline);
+
+		for (i = 0; i < ARRAY_SIZE(host.app_info->usr_attr_desc); i++) {
+			char *xml_att_desc;
+			char flag;
+
+			/* Skip attribute if *not* set */
+			if (~cmd->usrattr & (1 << i))
+				continue;
+
+			xml_att_desc = xml_escape(host.app_info->usr_attr_desc[i]);
+			print_func(data, "        <attribute doc='%s'", xml_att_desc);
+			talloc_free(xml_att_desc);
+
+			if ((flag = host.app_info->usr_attr_letters[i]) != '\0')
+				print_func(data, " flag='%c'", flag);
+			print_func(data, " />%s", newline);
+		}
+
+		print_func(data, "      </attributes>%s", newline);
+	}
+
 	print_func(data, "      <params>%s", newline);
 
-	int i;
 	for (i = 0; i < vector_count(cmd->strvec); ++i) {
 		vector descvec = vector_slot(cmd->strvec, i);
 		int j;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1f35368ba9178e1454f2e3ddfcad9d96576143ef
Gerrit-Change-Number: 19668
Gerrit-PatchSet: 13
Gerrit-Owner: fixeria <vyanitskiy 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-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200920/b83ec885/attachment.htm>


More information about the gerrit-log mailing list