aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/rc/lex.c')
-rw-r--r--sys/cmd/rc/lex.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/cmd/rc/lex.c b/sys/cmd/rc/lex.c
index e7c7d7d..b4a2e8c 100644
--- a/sys/cmd/rc/lex.c
+++ b/sys/cmd/rc/lex.c
@@ -15,16 +15,17 @@ struct Lexer
static struct Lexer lexer = { .c={0, EOF}, .doprompt=1 };
void
-yyerror(char *msg)
+yyerror(const char *msg)
{
- print(errio, "\nrc: ");
+ print(shell.err, "\nrc:%d: ", runner->line);
if(lexer.buf[0] && lexer.buf[0]!='\n')
- print(errio, "@ %q: ", lexer.buf);
+ print(shell.err, "%q: ", lexer.buf);
- print(errio, "%s\n", msg);
- flush(errio);
+ print(shell.err, "%s\n", msg);
+ flush(shell.err);
+ /* consume remaining tokens */
while(lexer.c[0] !='\n' && lexer.c[0] != EOF)
advance();
}
@@ -40,18 +41,18 @@ readc(void)
peek = EOF;
return c;
}
- if(proc->flag.eof)
+ if(runner->flag.eof)
return EOF;
if(!prompt(&lexer.doprompt))
exit(1); // XXX: hack for signal handling right now...
- c = get(proc->cmd.io);
+ c = get(runner->cmd.io);
lexer.doprompt = lexer.doprompt || c=='\n' || c==EOF;
if(c==EOF)
- proc->flag.eof = 1;
+ runner->flag.eof = 1;
return c;
}