Fix list-keys output for commands with different groups

When commands in braces span multiple lines, they get assigned to
different groups. The cmd_list_print() function was outputting \;\;
to separate commands with different groups, but this syntax is not
understood by the parser.

Change to always use \; as the separator regardless of group,
making the output valid syntax that can be re-parsed.

Fixes #3455
This commit is contained in:
Patrick Motard 2025-12-07 14:20:10 -06:00
parent ef0a7e328c
commit d1ec48d067

15
cmd.c
View File

@ -695,17 +695,10 @@ cmd_list_print(const struct cmd_list *cmdlist, int escaped)
next = TAILQ_NEXT(cmd, qentry);
if (next != NULL) {
if (cmd->group != next->group) {
if (escaped)
strlcat(buf, " \\;\\; ", len);
else
strlcat(buf, " ;; ", len);
} else {
if (escaped)
strlcat(buf, " \\; ", len);
else
strlcat(buf, " ; ", len);
}
if (escaped)
strlcat(buf, " \\; ", len);
else
strlcat(buf, " ; ", len);
}
free(this);