aboutsummaryrefslogtreecommitdiff
path: root/cmd-list.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-05-23 17:02:25 +0100
committerThomas Adam <thomas@xteddy.org>2019-05-23 17:02:25 +0100
commit43431e7e8458091c762792db39af3fef65e14412 (patch)
tree9887dff5841a98b0f31e561bd663bbedce9f2c38 /cmd-list.c
parent389cf63cbc027c995900bbdd6e68f4f5a96e5c08 (diff)
parenteb8b51effcd2dee7b95c811c894bf29387a272c9 (diff)
downloadrtmux-43431e7e8458091c762792db39af3fef65e14412.tar.gz
rtmux-43431e7e8458091c762792db39af3fef65e14412.tar.bz2
rtmux-43431e7e8458091c762792db39af3fef65e14412.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-list.c')
-rw-r--r--cmd-list.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd-list.c b/cmd-list.c
index ead0fb61..fdf2095d 100644
--- a/cmd-list.c
+++ b/cmd-list.c
@@ -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);
}