diff options
author | 2019-05-29 10:08:36 +0000 | |
---|---|---|
committer | 2019-05-29 10:08:36 +0000 | |
commit | dfc4c5100febc7c9da4aa2bb81c0021a8bd290f7 (patch) | |
tree | 75cc55db00a22ad0b20187ebfae136621538e599 | |
parent | After fixing the pfkey code a bit lets retry with a bit less workarounds. (diff) | |
download | wireguard-openbsd-dfc4c5100febc7c9da4aa2bb81c0021a8bd290f7.tar.xz wireguard-openbsd-dfc4c5100febc7c9da4aa2bb81c0021a8bd290f7.zip |
Support \ooo escapes, from Avi Halachmi.
-rw-r--r-- | usr.bin/tmux/cmd-parse.y | 28 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 10 |
2 files changed, 32 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-parse.y b/usr.bin/tmux/cmd-parse.y index 0180a0fe125..b68289926fa 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.6 2019/05/27 12:16:27 nicm Exp $ */ +/* $OpenBSD: cmd-parse.y,v 1.7 2019/05/29 10:08:36 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1083,12 +1083,34 @@ error: static int yylex_token_escape(char **buf, size_t *len) { - int ch, type; + int ch, type, o2, o3; u_int size, i, tmp; char s[9]; struct utf8_data ud; - switch (ch = yylex_getc()) { + ch = yylex_getc(); + + if (ch >= '4' && ch <= '7') { + yyerror("invalid octal escape"); + return (0); + } + if (ch >= '0' && ch <= '3') { + o2 = yylex_getc(); + if (o2 >= '0' && o2 <= '7') { + o3 = yylex_getc(); + if (o3 >= '0' && o3 <= '7') { + ch = 64 * (ch - '0') + + 8 * (o2 - '0') + + (o3 - '0'); + yylex_append1(buf, len, ch); + return (1); + } + } + yyerror("invalid octal escape"); + return (0); + } + + switch (ch) { case EOF: return (0); case 'e': diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 8f8bbf4be04..02aacfc1867 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.659 2019/05/28 11:46:30 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.660 2019/05/29 10:08:36 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 28 2019 $ +.Dd $Mdocdate: May 29 2019 $ .Dt TMUX 1 .Os .Sh NAME @@ -515,7 +515,11 @@ the given four or eight digit hexadecimal number. When preceded (escaped) by a \e, the following characters are replaced: \ee by the escape character; \er by a carriage return; \en by a newline; and \et by a tab. -.Pp +.It +\eooo is replaced by a character of the octal value ooo. +Three octal digits are required, for example \e001. +The largest valid character is \e377. +.It Any other characters preceded by \e are replaced by themselves (that is, the \e is removed) and are not treated as having any special meaning - so for example \e; will not mark a command sequence and \e$ will not expand an environment |