diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-06 20:22:19 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-06 20:22:19 +0200 |
commit | cbce394246c4b0d73ba491cecd4e1735b7afee91 (patch) | |
tree | 62fd919723805ce738bf0410360f0a8f6c0aa71e /src | |
parent | Going back the old way (diff) | |
download | 42-minishell-cbce394246c4b0d73ba491cecd4e1735b7afee91.tar.gz 42-minishell-cbce394246c4b0d73ba491cecd4e1735b7afee91.tar.bz2 42-minishell-cbce394246c4b0d73ba491cecd4e1735b7afee91.tar.xz 42-minishell-cbce394246c4b0d73ba491cecd4e1735b7afee91.tar.zst 42-minishell-cbce394246c4b0d73ba491cecd4e1735b7afee91.zip |
Old style rewrite in progress
Diffstat (limited to 'src')
-rw-r--r-- | src/e_builtins.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/e_builtins.c b/src/e_builtins.c index c76f438..607292e 100644 --- a/src/e_builtins.c +++ b/src/e_builtins.c @@ -21,6 +21,37 @@ #include "s_lcom.h" #include "s_struct.h" +static void + e_builtin_child(const t_lcom *ptr, + uint8_t bu_id, + t_msh *msh) +{ + int32_t ret; + + dup_redirs(ptr, msh); + ret = msh->bu_ptr[bu_id](ptr->argv + 1, msh); + lcom_clear(&msh->curr); + s_destroy(msh); + exit(ret); +} + +static void + e_builtin_parent(pid_t pid, + const t_lcom *ptr, + uint8_t bu_id, + t_msh *msh) +{ + int32_t status; + int32_t ret; + + (void)ptr; + while (wait(&status) != pid) + ; + ret = WEXITSTATUS(status); + if (bu_id != FT_ID_EXIT) + msh->ret = ret; +} + void e_builtin(const t_lcom *ptr, uint8_t bu_id, |