summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 18:30:35 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 18:30:35 +0200
commit4fe88a37306072c5eacf24ab4dd1913cc9c30d3c (patch)
tree1b8f6170809002f85e2711fcd8fc844c5dfd3246 /src
parentIn progress (diff)
download42-minishell-4fe88a37306072c5eacf24ab4dd1913cc9c30d3c.tar.gz
42-minishell-4fe88a37306072c5eacf24ab4dd1913cc9c30d3c.tar.bz2
42-minishell-4fe88a37306072c5eacf24ab4dd1913cc9c30d3c.tar.xz
42-minishell-4fe88a37306072c5eacf24ab4dd1913cc9c30d3c.tar.zst
42-minishell-4fe88a37306072c5eacf24ab4dd1913cc9c30d3c.zip
SHLVL boyy
Diffstat (limited to 'src')
-rw-r--r--src/m_minishell.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/m_minishell.c b/src/m_minishell.c
index 78700a1..c5901db 100644
--- a/src/m_minishell.c
+++ b/src/m_minishell.c
@@ -21,6 +21,7 @@
#include "s_struct.h"
#include "s_init.h"
#include "s_destroy.h"
+#include "u_vars.h"
#include "u_vars_next.h"
int
@@ -28,10 +29,10 @@ int
char *const argv[],
char *const envp[])
{
- t_msh *msh;
int32_t ret;
+ char *str;
+ t_msh *msh;
- /* TODO: increment $SHLVL */
/* TODO: also set $SHELL | maybe not bash does not set $SHELL */
/* only zsh does */
/* TODO: handle general variables | $var */
@@ -40,6 +41,8 @@ int
ft_dprintf(2, "%s\n", strerror(errno));
return (FT_RET_ALLOC);
}
+ u_subst_var_value("$SHLVL", str = ft_itoa(ft_atoi(u_get_var_value("$SHLVL", msh)) + 1), msh);
+ ft_memdel((void*)&str);
ret = m_argv(argc, argv, msh);
s_destroy(msh);
return (ret);