diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-11-05 17:40:52 +0100 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-11-05 17:40:52 +0100 |
commit | 2dbcdc9fbe10f7bc6eb019b0dcb5ac138b3f8371 (patch) | |
tree | 44a54efb3a1af9531839d55f06b9fc5c8af51de5 /src/c_input.c | |
parent | plen fixed (diff) | |
download | 42-minishell-2dbcdc9fbe10f7bc6eb019b0dcb5ac138b3f8371.tar.gz 42-minishell-2dbcdc9fbe10f7bc6eb019b0dcb5ac138b3f8371.tar.bz2 42-minishell-2dbcdc9fbe10f7bc6eb019b0dcb5ac138b3f8371.tar.xz 42-minishell-2dbcdc9fbe10f7bc6eb019b0dcb5ac138b3f8371.tar.zst 42-minishell-2dbcdc9fbe10f7bc6eb019b0dcb5ac138b3f8371.zip |
C-c arrows
Diffstat (limited to '')
-rw-r--r-- | src/c_input.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/c_input.c b/src/c_input.c index 7a23b90..8f15449 100644 --- a/src/c_input.c +++ b/src/c_input.c @@ -23,6 +23,21 @@ #include "m_prompt.h" #include "m_loop.h" + +void c_signal_int(int signo) +{ + signal(SIGINT, c_signal_int); + (void)signo; + ioctl(1, TIOCSTI, "\002"); +} + +void signal_ign(int signo) +{ + signal(SIGINT, c_signal_int); + (void)signo; + signal(SIGTSTP, SIG_IGN); +} + short c_init_line(char psx, t_caps *tcaps) { @@ -34,7 +49,8 @@ short if (!tgetent(NULL, term)) return (-1); c_set_term_raw(1); - signal(SIGINT, SIG_IGN); + signal(SIGINT, c_signal_int); + signal(SIGQUIT, signal_ign); tcaps->cpos = 0; tcaps->lpos = 0; tcaps->nlines = 1; |