42_minishell/signal/signal.c

38 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* signal.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/28 15:59:01 by cchauvet #+# #+# */
/* Updated: 2023/04/11 13:02:34 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "signal_private.h"
void ft_ctrlc(int num)
{
if (*ft_get_heredoc() != -1)
{
close(*ft_get_heredoc());
*ft_get_heredoc() = -1;
}
else
{
rl_replace_line("", 0);
rl_on_new_line();
ft_putchar_fd('\n', 1);
rl_redisplay();
}
*ft_get_exit_code() = 130;
(void) num;
}
void ft_quit(int num)
{
(void) num;
ft_printf("Quit (core dumped)\n");
}