opendoas

my fork of doas with custom prompt
git clone git://git.kocotian.pl/opendoas.git
Log | Files | Refs | README | LICENSE

commit 454489f79baa3ee1c56498a1c35606b43822f138
parent 2d7431ca9ec0b3204a5e9fd01d0fffd946c4d430
Author: tedu <tedu>
Date:   Fri,  4 Dec 2015 09:41:49 +0000

espie reminds me that EOF can happen for errors as well, so check for that
happening and print a message.

Diffstat:
Mparse.y | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/parse.y b/parse.y @@ -251,12 +251,12 @@ repeat: /* skip comments; NUL is allowed; no continuation */ while ((c = getc(yyfp)) != '\n') if (c == EOF) - return 0; + goto eof; yylval.colno = 0; yylval.lineno++; return c; case EOF: - return 0; + goto eof; } /* parsing next word */ @@ -330,7 +330,7 @@ eow: * the main loop. */ if (c == EOF) - return 0; + goto eof; else if (qpos == -1) /* accept, e.g., empty args: cmd foo args "" */ goto repeat; } @@ -344,4 +344,9 @@ eow: err(1, "%s", __func__); yylval.str = str; return TSTRING; + +eof: + if (ferror(yyfp)) + yyerror("input error reading config"); + return 0; }