From 47e3d475df6244a48b73421cd4210b64c392df8d Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Tue, 19 Oct 2021 09:35:59 -0700 Subject: feat(rc): cleaner process watching for each job --- sys/cmd/rc/lex.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sys/cmd/rc/lex.c') 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; } -- cgit v1.2.1