summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-06 13:08:36 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-06 13:08:36 -0700
commit59aa1488ac6deec474dc5287d4866223e1bcd005 (patch)
tree79c9d6fbaf3c252bfe44b4727754f124a7bc168e /parser.c
parent7ffe8d302ab56ffe96023daf015a477934b7f17b (diff)
downloadtxr-59aa1488ac6deec474dc5287d4866223e1bcd005.tar.gz
txr-59aa1488ac6deec474dc5287d4866223e1bcd005.tar.bz2
txr-59aa1488ac6deec474dc5287d4866223e1bcd005.zip
Distinguish interrupt indication from linenoise.
* parser.c (repl): If linenoise returns a null pointer, but the last error is lino_eof, print "** intr" message and continue; do not quit.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index f346c69c..c682f100 100644
--- a/parser.c
+++ b/parser.c
@@ -509,8 +509,12 @@ val repl(val bindings, val in_stream, val out_stream)
free (prompt_u8);
prompt_u8 = 0;
- if (line_u8 == 0)
- break;
+ if (line_u8 == 0) {
+ if (lino_get_error(ls) == lino_eof)
+ break;
+ put_line(lit("** intr"), out_stream);
+ continue;
+ }
if (strspn(line_u8, " \t") == strlen(line_u8))
continue;