fix: ctrl + c is now support in heredoc and in normal mode

This commit is contained in:
Camille Chauvet 2023-04-11 13:03:42 +00:00
parent a48da783dd
commit a6a0293095

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/28 15:59:01 by cchauvet #+# #+# */ /* Created: 2023/03/28 15:59:01 by cchauvet #+# #+# */
/* Updated: 2023/04/05 15:05:11 by alouis-j ### ########.fr */ /* Updated: 2023/04/11 13:02:34 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,11 +14,20 @@
void ft_ctrlc(int num) void ft_ctrlc(int num)
{ {
(void) num; if (*ft_get_heredoc() != -1)
{
close(*ft_get_heredoc());
*ft_get_heredoc() = -1;
}
else
{
rl_replace_line("", 0); rl_replace_line("", 0);
rl_on_new_line(); rl_on_new_line();
ft_putchar_fd('\n', 1); ft_putchar_fd('\n', 1);
rl_redisplay(); rl_redisplay();
}
*ft_get_exit_code() = 130;
(void) num;
} }
void ft_quit(int num) void ft_quit(int num)