summaryrefslogtreecommitdiffstats
path: root/src/ft_e_builtins.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-28 14:45:38 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-28 14:45:38 +0200
commit26debd1a134bfe6b4b400136c75b30d368a39252 (patch)
treefb16a6befac3470f6e45a139d4f99fb66cd6f469 /src/ft_e_builtins.c
parentRemoved useless function made obsolete by subst_var_value (diff)
download42-minishell-26debd1a134bfe6b4b400136c75b30d368a39252.tar.gz
42-minishell-26debd1a134bfe6b4b400136c75b30d368a39252.tar.bz2
42-minishell-26debd1a134bfe6b4b400136c75b30d368a39252.tar.xz
42-minishell-26debd1a134bfe6b4b400136c75b30d368a39252.tar.zst
42-minishell-26debd1a134bfe6b4b400136c75b30d368a39252.zip
Ok cd
Diffstat (limited to '')
-rw-r--r--src/ft_e_builtins.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ft_e_builtins.c b/src/ft_e_builtins.c
index bc3eece..1045856 100644
--- a/src/ft_e_builtins.c
+++ b/src/ft_e_builtins.c
@@ -16,6 +16,7 @@
#include <stdint.h>
#include <unistd.h>
+#include "ft_b_builtins.h"
#include "ft_m_redirs.h"
#include "ft_s_destroy.h"
#include "ft_s_lcom.h"
@@ -37,6 +38,8 @@ static void
static void
ft_e_builtin_parent(pid_t pid,
+ const t_lcom *ptr,
+ uint8_t bu_id,
t_msh *msh)
{
int32_t status;
@@ -44,6 +47,10 @@ static void
while (wait(&status) != pid)
;
msh->ret = WEXITSTATUS(status);
+ if (bu_id == 1 && msh->ret == 0)
+ {
+ ft_b_cd(ptr->argv + 1, msh);
+ }
}
void
@@ -64,6 +71,6 @@ void
}
else
{
- ft_e_builtin_parent(pid, msh);
+ ft_e_builtin_parent(pid, ptr, bu_id, msh);
}
}