From 0761931691e27db6d4e2cbd44442279635d029f3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 10 Jan 2017 11:58:31 +0000 Subject: Quote backslash as well for %%%. --- usr.bin/tmux/cmd.c | 6 +++--- 1 file 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 @@ -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; } -- cgit v1.2.3