diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-10 11:58:31 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-10 11:58:31 +0000 |
commit | 0761931691e27db6d4e2cbd44442279635d029f3 (patch) | |
tree | 096a4b55273e34983cf88238a4cafdf66b9b9b96 | |
parent | adfff6d9ab7dcc10c82a2fa269dad49a4623b9cf (diff) |
Quote backslash as well for %%%.
-rw-r--r-- | usr.bin/tmux/cmd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index d5f325fa0f8..5703e6f5ab3 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.130 2017/01/06 11:57:03 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.131 2017/01/10 11:58:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -663,7 +663,7 @@ char * cmd_template_replace(const char *template, const char *s, int idx) { char ch, *buf; - const char *ptr, *cp; + const char *ptr, *cp, quote[] = "\"\\$"; int replaced, quoted; size_t len; @@ -692,7 +692,7 @@ cmd_template_replace(const char *template, const char *s, int idx) buf = xrealloc(buf, len + (strlen(s) * 2) + 1); for (cp = s; *cp != '\0'; cp++) { - if (quoted && (*cp == '"' || *cp == '$')) + if (quoted && strchr(quote, *cp) != NULL) buf[len++] = '\\'; buf[len++] = *cp; } |