changement signaux et reactivation du echoctl quand exit

This commit is contained in:
2024-03-27 14:30:32 +01:00
parent ca90a5f692
commit dad89c923e
9 changed files with 42 additions and 11 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */
/* Updated: 2024/03/26 14:06:33 by tomoron ### ########.fr */
/* Updated: 2024/03/26 17:25:20 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -107,9 +107,12 @@ int init_minishell(t_msh **msh, int argc, char **argv, char **envp)
(void)argc;
(void)argv;
(*msh)->env = get_env(envp);
tcgetattr(1, &t_p);
(*msh)->echoctl = t_p.c_lflag & ECHOCTL;
signal(SIGINT, signal_handler_interactive);
signal(SIGQUIT, signal_handler_interactive);
t_p.c_lflag = t_p.c_lflag & (~ECHOCTL);
if(set_echoctl(0))
ft_exit(*msh, 1);
return (0);
}
@ -135,6 +138,7 @@ int main(int argc, char **argv, char **envp)
free_cmd(msh->cmds);
}
rl_clear_history();
set_echoctl(msh->echoctl);
free_msh(msh);
ft_printf("exit\n");
return (g_return_code);