aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/more.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/toys/pending/more.c b/toys/pending/more.c
index 59b5c615..7923ee4e 100644
--- a/toys/pending/more.c
+++ b/toys/pending/more.c
@@ -25,7 +25,12 @@ GLOBALS(
static void signal_handler(int sig)
{
+ // Reset the terminal whether we were signalled or exited normally.
tcsetattr(TT.cin_fd, TCSANOW, &TT.inf);
+
+ if (sig == 0) _exit(0);
+
+ // We were actually signalled, so move to a new line and re-raise the signal.
xputc('\n');
signal(sig, SIG_DFL);
raise(sig);