diff options
Diffstat (limited to 'src/s_init.c')
-rw-r--r-- | src/s_init.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/s_init.c b/src/s_init.c index 454cb67..377cd91 100644 --- a/src/s_init.c +++ b/src/s_init.c @@ -18,6 +18,8 @@ #include "d_define.h" #include "m_funptr.h" #include "s_init.h" +#include "u_vars.h" +#include "u_vars_next.h" static char **dupenv_del(char **nenvp, @@ -58,6 +60,19 @@ static char return (nenvp); } +static void + inc_shlvl(t_msh *msh) +{ + char *str_one; + char *str_two; + + u_subst_var_value("$SHLVL", + str_one = ft_itoa( + ft_atoi(str_two = u_get_var_value("$SHLVL", msh)) + 1), msh); + ft_memdel((void*)&str_one); + ft_memdel((void*)&str_two); +} + t_msh *init_msh(char *const argv[], char *const envp[]) @@ -81,5 +96,6 @@ t_msh init_buptr(msh); msh->curr = NULL; msh->vars = NULL; + inc_shlvl(msh); return (msh); } |