42-archive/42sh/src/line-editing/sigint_handler.c
2016-12-10 17:47:36 +01:00

28 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sigint_handler.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 15:14:47 by jhalford #+# #+# */
/* Updated: 2016/12/10 15:31:56 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
pid_t g_pid;
void sigint_handler(int signo)
{
(void)signo;
if (signo == SIGINT)
{
DG("got SIGINT");
if (g_pid)
kill(g_pid, SIGINT);
if (kill(g_pid, 0) == 0)
ft_putendl("");
}
}