summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-05-29 20:05:16 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-05-29 20:05:16 +0000
commit787d4d982bb0fbe5e15f19fd39e2ca4c0e6e5cbf (patch)
tree667a90dda56a4c74764381aa4785eca8fedd77b3
parentb38d16d286cdad6dbb28f1811de5e6c7ce437284 (diff)
Use VIS_CSTYLE for the arguments and add the missing escapes it can
generate to the parser.
-rw-r--r--usr.bin/tmux/arguments.c4
-rw-r--r--usr.bin/tmux/cmd-parse.y17
-rw-r--r--usr.bin/tmux/tty-term.c4
-rw-r--r--usr.bin/tmux/window-buffer.c4
4 files changed, 22 insertions, 7 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index c583d22a37c..41562fd4dcc 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.24 2019/05/28 18:30:30 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.25 2019/05/29 20:05:14 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -218,7 +218,7 @@ args_escape(const char *s)
return (escaped);
}
- flags = VIS_OCTAL|VIS_TAB|VIS_NL;
+ flags = VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL;
if (s[strcspn(s, quoted)] != '\0')
flags |= VIS_DQ;
utf8_stravis(&escaped, s, flags);
diff --git a/usr.bin/tmux/cmd-parse.y b/usr.bin/tmux/cmd-parse.y
index ea13fd3da6f..b7b0eccd23d 100644
--- a/usr.bin/tmux/cmd-parse.y
+++ b/usr.bin/tmux/cmd-parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-parse.y,v 1.8 2019/05/29 19:34:42 nicm Exp $ */
+/* $OpenBSD: cmd-parse.y,v 1.9 2019/05/29 20:05:14 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1118,9 +1118,24 @@ yylex_token_escape(char **buf, size_t *len)
switch (ch) {
case EOF:
return (0);
+ case 'a':
+ ch = '\a';
+ break;
+ case 'b':
+ ch = '\b';
+ break;
case 'e':
ch = '\033';
break;
+ case 'f':
+ ch = '\f';
+ break;
+ case 's':
+ ch = ' ';
+ break;
+ case 'v':
+ ch = '\v';
+ break;
case 'r':
ch = '\r';
break;
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c
index ec44c6ec68e..95950442e5c 100644
--- a/usr.bin/tmux/tty-term.c
+++ b/usr.bin/tmux/tty-term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-term.c,v 1.64 2019/05/13 20:10:23 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.65 2019/05/29 20:05:15 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -685,7 +685,7 @@ tty_term_describe(struct tty_term *term, enum tty_code_code code)
break;
case TTYCODE_STRING:
strnvis(out, term->codes[code].value.string, sizeof out,
- VIS_OCTAL|VIS_TAB|VIS_NL);
+ VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
xsnprintf(s, sizeof s, "%4u: %s: (string) %s",
code, tty_term_codes[code].name,
out);
diff --git a/usr.bin/tmux/window-buffer.c b/usr.bin/tmux/window-buffer.c
index 46e6e4f9f88..2927029f997 100644
--- a/usr.bin/tmux/window-buffer.c
+++ b/usr.bin/tmux/window-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-buffer.c,v 1.20 2019/05/28 07:18:42 nicm Exp $ */
+/* $OpenBSD: window-buffer.c,v 1.21 2019/05/29 20:05:15 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -246,7 +246,7 @@ window_buffer_draw(__unused void *modedata, void *itemdata,
at = 0;
while (end != pdata + psize && *end != '\n') {
if ((sizeof line) - at > 5) {
- cp = vis(line + at, *end, VIS_TAB|VIS_OCTAL, 0);
+ cp = vis(line + at, *end, VIS_OCTAL|VIS_TAB, 0);
at = cp - line;
}
end++;