From 34e94f3c3a791c35718a3e04715f2b48555c5598 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 15 Aug 2020 23:27:55 +0700 Subject: vty: print program specific attributes in the XML reference Change-Id: I1f35368ba9178e1454f2e3ddfcad9d96576143ef Related: SYS#4937 --- src/vty/command.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/vty/command.c b/src/vty/command.c index 722b3e05..bad26888 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -628,11 +628,36 @@ typedef int (*print_func_t)(void *data, const char *fmt, ...); 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, " %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, " %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, " usr_attr_letters[i]) != '\0') + print_func(data, " flag='%c'", flag); + print_func(data, " />%s", newline); + } + + print_func(data, " %s", newline); + } + print_func(data, " %s", newline); - int i; for (i = 0; i < vector_count(cmd->strvec); ++i) { vector descvec = vector_slot(cmd->strvec, i); int j; -- cgit v1.2.3