From 931d64f8de509a4528839ec74bfa573c4ee339e9 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 15 Sep 2014 23:31:24 -0400 Subject: %*s can't be used to truncate, so stop trying --- src/parser.c | 33 +++++++++++++++------------------ src/parser.h | 2 +- src/parser.l | 17 +++++++---------- 3 files changed, 23 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/parser.c b/src/parser.c index 608ebba..690b7dd 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1192,66 +1192,63 @@ YY_RULE_SETUP #line 182 "src/parser.l" { fprintf(stderr, - "unhandled CSI sequence: \\033%*s\\%hho\n", - (int)yyleng - 2, yytext + 1, yytext[yyleng - 1]); + "unhandled CSI sequence: \\033%s\\%hho\n", + yytext + 1, yytext[yyleng - 1]); } YY_BREAK case 50: YY_RULE_SETUP #line 188 "src/parser.l" { - fprintf(stderr, - "unhandled CSI sequence: \\033%*s\n", - (int)yyleng - 1, yytext + 1); + fprintf(stderr, "unhandled CSI sequence: \\033%s\n", yytext + 1); } YY_BREAK case 51: YY_RULE_SETUP -#line 194 "src/parser.l" +#line 192 "src/parser.l" { + yytext[yyleng - 1] = '\0'; fprintf(stderr, - "%d unhandled OSC sequence: \\033%*s\\007\n", - (int)yyleng, (int)yyleng - 5, yytext + 1); + "unhandled OSC sequence: \\033%s\\007\n", + yytext + 1); } YY_BREAK case 52: /* rule 52 can match eol */ YY_RULE_SETUP -#line 200 "src/parser.l" +#line 199 "src/parser.l" { fprintf(stderr, "unhandled escape sequence: \\%hho\n", yytext[1]); } YY_BREAK case 53: YY_RULE_SETUP -#line 204 "src/parser.l" +#line 203 "src/parser.l" { - fprintf(stderr, - "unhandled escape sequence: %*s\n", - (int)yyleng - 1, yytext + 1); + fprintf(stderr, "unhandled escape sequence: %s\n", yytext + 1); } YY_BREAK case 54: /* rule 54 can match eol */ YY_RULE_SETUP -#line 210 "src/parser.l" +#line 207 "src/parser.l" { fprintf(stderr, "unhandled control character: \\%hho\n", yytext[0]); } YY_BREAK case 55: YY_RULE_SETUP -#line 214 "src/parser.l" +#line 211 "src/parser.l" { fprintf(stderr, "invalid utf8 byte: \\%hho\n", yytext[0]); } YY_BREAK case 56: YY_RULE_SETUP -#line 218 "src/parser.l" +#line 215 "src/parser.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1255 "src/parser.c" +#line 1252 "src/parser.c" case YY_END_OF_BUFFER: { @@ -2343,7 +2340,7 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 218 "src/parser.l" +#line 215 "src/parser.l" diff --git a/src/parser.h b/src/parser.h index e4f71da..10ad44c 100644 --- a/src/parser.h +++ b/src/parser.h @@ -330,7 +330,7 @@ extern int vt100_parser_yylex (yyscan_t yyscanner); #undef YY_DECL #endif -#line 218 "src/parser.l" +#line 215 "src/parser.l" #line 337 "src/parser.h" diff --git a/src/parser.l b/src/parser.l index f36a4e6..d3ac6d7 100644 --- a/src/parser.l +++ b/src/parser.l @@ -181,20 +181,19 @@ static void vt100_parser_handle_text(VT100Screen *vt, char *text, size_t len); {CSI}[<=?]?{CSIPARAMS}{CTRL} { fprintf(stderr, - "unhandled CSI sequence: \\033%*s\\%hho\n", - (int)yyleng - 2, yytext + 1, yytext[yyleng - 1]); + "unhandled CSI sequence: \\033%s\\%hho\n", + yytext + 1, yytext[yyleng - 1]); } {CSI}[<=?]?{CSIPARAMS}{CHAR} { - fprintf(stderr, - "unhandled CSI sequence: \\033%*s\n", - (int)yyleng - 1, yytext + 1); + fprintf(stderr, "unhandled CSI sequence: \\033%s\n", yytext + 1); } {OSC}{CHAR}*{ST} { + yytext[yyleng - 1] = '\0'; fprintf(stderr, - "unhandled OSC sequence: \\033%*s\\007\n", - (int)yyleng - 2, yytext + 1); + "unhandled OSC sequence: \\033%s\\007\n", + yytext + 1); } {ESC}{CTRL} { @@ -202,9 +201,7 @@ static void vt100_parser_handle_text(VT100Screen *vt, char *text, size_t len); } {ESC}{CHAR} { - fprintf(stderr, - "unhandled escape sequence: %*s\n", - (int)yyleng - 1, yytext + 1); + fprintf(stderr, "unhandled escape sequence: %s\n", yytext + 1); } {CTRL} { -- cgit v1.2.3-54-g00ecf