summaryrefslogtreecommitdiffstats
path: root/src/ft_e_builtins.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 16:30:46 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 16:30:46 +0200
commit2ed54aa7bda6cb3840a2e44f60751c1a4396d0f9 (patch)
tree21da9b68fea982bf3cb6059d27e2f2e339d4870f /src/ft_e_builtins.c
parentPrepared builtins templates (diff)
download42-minishell-2ed54aa7bda6cb3840a2e44f60751c1a4396d0f9.tar.gz
42-minishell-2ed54aa7bda6cb3840a2e44f60751c1a4396d0f9.tar.bz2
42-minishell-2ed54aa7bda6cb3840a2e44f60751c1a4396d0f9.tar.xz
42-minishell-2ed54aa7bda6cb3840a2e44f60751c1a4396d0f9.tar.zst
42-minishell-2ed54aa7bda6cb3840a2e44f60751c1a4396d0f9.zip
Now searching in $PATH
Diffstat (limited to '')
-rw-r--r--src/ft_e_builtins.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/ft_e_builtins.c b/src/ft_e_builtins.c
index 34a8534..b47b0f9 100644
--- a/src/ft_e_builtins.c
+++ b/src/ft_e_builtins.c
@@ -86,24 +86,17 @@ void
{
pid_t pid;
- /* TODO: handle exit | bu_id = 6 */
- if (bu_id != 6)
+ /* TODO: find a way to handle exit | bu_id = 6 */
+ if ((pid = fork()) == 0)
{
- if ((pid = fork()) == 0)
- {
- ft_e_builtin_child(ptr, bu_id, msh);
- }
- else if (pid < 0)
- {
- /* TODO: handle fork failed */
- }
- else
- {
- ft_e_builtin_parent(pid, msh);
- }
+ ft_e_builtin_child(ptr, bu_id, msh);
+ }
+ else if (pid < 0)
+ {
+ /* TODO: handle fork failed */
}
else
{
- msh->ret = msh->bu_ptr[bu_id](ptr->args, msh);
+ ft_e_builtin_parent(pid, msh);
}
}