summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-09-19 09:44:39 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-09-19 09:44:39 +0000
commitd30971a0f40d716b644eecbd1d874742d84d57fd (patch)
tree7ab1b1b6d5c5bd7effdad00cbf20114b9e0f2aaf
parente8b0a65926d5a5ff368f385b8f40e872b3e41537 (diff)
downloadbc-tarball-baserock/liw/S8700-bc-segfault.tar.gz
Fix readline use so that control-c clears input bufferbaserock/liw/S8700-bc-segfault
Patch from Debian's bc package (see Debian bug #287210). Basically, without the patch, bc won't clear the input buffer when the user types control-C, and so this happens: 1 (interrupt) use quit to exit. 2+3 15 The expected result is 6, not 15.
-rw-r--r--bc/main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bc/main.c b/bc/main.c
index 9a2461e..3ae427d 100644
--- a/bc/main.c
+++ b/bc/main.c
@@ -358,6 +358,9 @@ use_quit (sig)
errno = save;
#else
write (1, "\n(interrupt) Exiting bc.\n", 26);
+#ifdef READLINE
+ rl_initialize (); /* Clear readline buffer */
+#endif
#if defined(LIBEDIT)
if (edit != NULL)
el_end(edit);