diff options
author | nicm <nicm> | 2019-05-23 14:03:44 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-05-23 14:03:44 +0000 |
commit | 27bfb56ad5e19afa686ed6a99bf8b205fac98aef (patch) | |
tree | 9d7eafe33dfe96c3194bbce93d43013e3565af39 /cmd-list.c | |
parent | 3e3eb1dd0faa707fa6bdfd12d455ad711d775241 (diff) | |
download | rtmux-27bfb56ad5e19afa686ed6a99bf8b205fac98aef.tar.gz rtmux-27bfb56ad5e19afa686ed6a99bf8b205fac98aef.tar.bz2 rtmux-27bfb56ad5e19afa686ed6a99bf8b205fac98aef.zip |
Break the argument escaping code into a separate function and use it to
escape key bindings in list-keys. Also escape ~ and ; and $ properly.
Diffstat (limited to 'cmd-list.c')
-rw-r--r-- | cmd-list.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -129,7 +129,7 @@ cmd_list_free(struct cmd_list *cmdlist) } char * -cmd_list_print(struct cmd_list *cmdlist) +cmd_list_print(struct cmd_list *cmdlist, int escaped) { struct cmd *cmd; char *buf, *this; @@ -141,12 +141,16 @@ cmd_list_print(struct cmd_list *cmdlist) TAILQ_FOREACH(cmd, &cmdlist->list, qentry) { this = cmd_print(cmd); - len += strlen(this) + 3; + len += strlen(this) + 4; buf = xrealloc(buf, len); strlcat(buf, this, len); - if (TAILQ_NEXT(cmd, qentry) != NULL) - strlcat(buf, " ; ", len); + if (TAILQ_NEXT(cmd, qentry) != NULL) { + if (escaped) + strlcat(buf, " \\; ", len); + else + strlcat(buf, " ; ", len); + } free(this); } |