summaryrefslogtreecommitdiffstats
path: root/cmd-parse.y
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-05-29 23:02:25 +0100
committerThomas Adam <thomas@xteddy.org>2019-05-29 23:02:25 +0100
commit414208aab1d7a6ed346a2fb5249d022be5617260 (patch)
treef4b6a65e55c66843e6ab274dda1d352cb866b44e /cmd-parse.y
parent95d68fcba137cc140d90b65de6bde1f502d3cbc1 (diff)
parent7dced376737ef685e09fd5a49161ca2bf423e91b (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-parse.y')
-rw-r--r--cmd-parse.y22
1 files changed, 21 insertions, 1 deletions
diff --git a/cmd-parse.y b/cmd-parse.y
index 739ca56c..a623caa5 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -58,6 +58,7 @@ struct cmd_parse_state {
size_t len;
size_t off;
+ int eol;
int eof;
struct cmd_parse_input *input;
u_int escapes;
@@ -933,6 +934,10 @@ yylex(void)
char *token, *cp;
int ch, next;
+ if (ps->eol)
+ ps->input->line++;
+ ps->eol = 0;
+
for (;;) {
ch = yylex_getc();
@@ -959,7 +964,7 @@ yylex(void)
/*
* End of line. Update the line number.
*/
- ps->input->line++;
+ ps->eol = 1;
return ('\n');
}
@@ -1113,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;