summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-08 20:00:45 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-08 20:00:45 -0700
commit0eeb2089e6fa8781d5016d333d837c87e17f4a19 (patch)
treeb4daa7a86a7747c7ea730cb1e013d9eaf41a0d2f /parser.c
parentf21088bdc23d0195b3396b96c3b4d3b1a2d4b255 (diff)
downloadtxr-0eeb2089e6fa8781d5016d333d837c87e17f4a19.tar.gz
txr-0eeb2089e6fa8781d5016d333d837c87e17f4a19.tar.bz2
txr-0eeb2089e6fa8781d5016d333d837c87e17f4a19.zip
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.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c13
1 files changed, 10 insertions, 3 deletions
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))