summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authornicm <nicm>2017-01-10 11:58:30 +0000
committernicm <nicm>2017-01-10 11:58:30 +0000
commit5ea7a00ebac6d6d6423667a3637bc575515b3be0 (patch)
treed56dfe514b1fd7795e33a2deab7060c08e9ffb15 /cmd.c
parente78142232fad8099912655a1910ab925c6f4a5aa (diff)
Quote backslash as well for %%%.
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd.c b/cmd.c
index 9791bee7..9dfff885 100644
--- a/cmd.c
+++ b/cmd.c
@@ -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;
}