add ctrl-c and ctrl-d aka eof handling

This commit is contained in:
hugogogo
2021-11-10 13:46:17 +01:00
parent 0a33916c75
commit d65a701186
5 changed files with 26 additions and 116 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 09:22:12 by lperrey #+# #+# */
/* Updated: 2021/11/02 13:50:33 by hulamy ### ########.fr */
/* Updated: 2021/11/10 13:43:59 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -28,13 +28,7 @@ int init(t_all *c, char *envp[])
c->prompt = init_prompt(c->prompt_base);
if (!c->prompt)
return (ft_reti_perror(0, "init_prompt() error"));
set_signals_handling(&c->ori_signal_behaviour, &c->signal_behaviour);
if (isatty(STDIN_FILENO))
{
if (!set_terminal_attributes(&c->ori_termios, &c->interactive_termios,
&c->termios_changed))
return (ft_reti_perror(0, "set_terminal_attributes() error"));
}
set_signals_handling(&c->signal_behaviour);
return (1);
}