diff --git a/main.c b/main.c index aa23316..7d4ffc8 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: cchauvet -static char *ft_get_user_input(t_list **env) +static char *ft_get_user_input() { char *line; char *prompt; @@ -106,25 +106,39 @@ int main(int ac, char **av, char **env) void ft_ctrlc(int num) { + (void) num; if (*ft_get_heredoc()) { kill(*ft_get_heredoc(), SIGQUIT); - ft_putchar_fd('\n', 1); } else { - rl_redisplay(); rl_on_new_line(); - rl_replace_line("", 0); + ft_putchar_fd('\n', 1); + rl_redisplay(); } } +void ft_quit(int num) +{ + (void) num; + if (*ft_get_heredoc()) + { + ft_printf("pb"); + } + else + ft_printf("bozoman"); +} + int main(int ac, char **av, char **env) { t_data data; char *line; + (void) ac; + (void) av; signal(SIGINT, ft_ctrlc); + signal(SIGQUIT, ft_quit); data.env = init_env(env); if (data.env == NULL) return (1); @@ -135,7 +149,7 @@ int main(int ac, char **av, char **env) free(data.env); return (1); } - line = ft_get_user_input(data.env); + line = ft_get_user_input(); if (line == NULL) { ft_lstclear(data.env, env_del); @@ -147,7 +161,7 @@ int main(int ac, char **av, char **env) if (ft_minishell(&data, line) == -1) break ; free(line); - line = ft_get_user_input(data.env); + line = ft_get_user_input(); if (line == NULL) { ft_lstclear(data.env, env_del);