Change in libosmocore[master]: vty: fix vty_dump_element(): do not print empty <attributes>

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
Wed Oct 7 10:03:48 UTC 2020


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

Change subject: vty: fix vty_dump_element(): do not print empty <attributes>
......................................................................

vty: fix vty_dump_element(): do not print empty <attributes>

Some attributes like CMD_ATTR_LIB_COMMAND are not being printed
to the XML VTY reference (despite being set), so we should not
print empty "<attributes scope='global'></attributes>".

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

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



diff --git a/src/vty/command.c b/src/vty/command.c
index d71f686..4952567 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -631,6 +631,10 @@
 	{ 0, NULL }
 };
 
+/* Public attributes (to be printed in the VTY / XML reference) */
+#define CMD_ATTR_PUBLIC_MASK \
+	(CMD_ATTR_IMMEDIATE | CMD_ATTR_NODE_EXIT)
+
 /* Get a flag character for a global VTY command attribute */
 static char cmd_attr_get_flag(unsigned int attr)
 {
@@ -670,7 +674,7 @@
 	print_func(data, "    <command id='%s'>%s", xml_string, newline);
 
 	/* Print global attributes and their description */
-	if (cmd->attr != 0x00) { /* ... if at least one flag is set */
+	if (cmd->attr & CMD_ATTR_PUBLIC_MASK) { /* ... only public ones */
 		print_func(data, "      <attributes scope='global'>%s", newline);
 
 		for (i = 0; i < ARRAY_SIZE(cmd_attr_desc) - 1; i++) {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie7e53b080c10564bfef6f0e8ddeb470e46fad387
Gerrit-Change-Number: 20473
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201007/c64f33e6/attachment.htm>


More information about the gerrit-log mailing list