signaux here_doc

This commit is contained in:
2024-04-26 11:07:30 +02:00
parent 40a5533c5f
commit 0a2ec43f41
4 changed files with 18 additions and 15 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/04/26 10:24:46 by tomoron ### ########.fr */
/* Updated: 2024/04/26 11:02:41 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -82,7 +82,7 @@ t_env *add_shlvl(t_env *env)
else
nb = ft_atoi(tmp);
nb++;
if(nb < 0)
if (nb < 0)
nb = 0;
env = export_set_env(env, ft_strdup("SHLVL"), ft_itoa(nb), 0);
return (env);
@ -90,11 +90,18 @@ t_env *add_shlvl(t_env *env)
int init_minishell(t_msh **msh, int argc, char **argv, char **envp)
{
struct termios t_p;
*msh = ft_calloc(1, sizeof(t_msh));
if (!*msh)
exit(1);
(void)argc;
(void)argv;
if (isatty(1))
{
tcgetattr(1, &t_p);
(*msh)->echoctl = t_p.c_lflag & ECHOCTL;
}
(*msh)->env = get_env(envp);
(*msh)->env = add_shlvl((*msh)->env);
rl_catch_signals = 0;