From 0eeb2089e6fa8781d5016d333d837c87e17f4a19 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 8 Sep 2015 20:00:45 -0700 Subject: Refinement in linenoise eof/intr handling. * parser.c (repl): Rather than breaking out of the loop when linenoise indicates lino_eof, break out of the loop for any error not equal to lino_intr. If the termination was due to other than lino_eof, print an error message. --- parser.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'parser.c') diff --git a/parser.c b/parser.c index 92c67829..6cf79fb6 100644 --- a/parser.c +++ b/parser.c @@ -547,10 +547,17 @@ val repl(val bindings, val in_stream, val out_stream) prompt_u8 = 0; if (line_u8 == 0) { - if (lino_get_error(ls) == lino_eof) + switch (lino_get_error(ls)) { + case lino_intr: + put_line(lit("** intr"), out_stream); + continue; + case lino_eof: break; - put_line(lit("** intr"), out_stream); - continue; + default: + put_line(lit("** error reading interactive input"), out_stream); + break; + } + break; } if (strspn(line_u8, " \t") == strlen(line_u8)) -- cgit v1.2.3