summaryrefslogtreecommitdiffstats
path: root/src/e_builtins.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-10-26 13:42:56 +0100
committersalad <fmoenne-@student.le-101.fr>2020-10-26 13:42:56 +0100
commit0277ddfac754ab4ad5bdd2b692e31a717efbe569 (patch)
tree49d7c5fd3a12248af85e2c3a3254bc1538ae5775 /src/e_builtins.c
parentreqdy for MERGE (diff)
parentTODO update (diff)
download42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.gz
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.bz2
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.xz
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.tar.zst
42-minishell-0277ddfac754ab4ad5bdd2b692e31a717efbe569.zip
merge wif master
Diffstat (limited to 'src/e_builtins.c')
-rw-r--r--src/e_builtins.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/e_builtins.c b/src/e_builtins.c
index 18abc16..90e436e 100644
--- a/src/e_builtins.c
+++ b/src/e_builtins.c
@@ -16,9 +16,12 @@
#include <stdint.h>
#include <unistd.h>
+#include "b_builtins.h"
#include "b_export_next.h"
#include "b_export_mute.h"
+#include "m_loop.h"
#include "m_redirs.h"
+#include "s_com.h"
#include "s_destroy.h"
#include "s_line.h"
#include "s_struct.h"
@@ -49,7 +52,8 @@ static void
e_export_env_fork(ptr, msh);
dup_redirs(ptr, msh);
ret = msh->bu_ptr[bu_id](ptr->argv + 1, msh);
- u_eof_stdin();
+ u_eof_fd(msh->fd);
+ s_com_destroy(&msh->com);
s_line_clear(&msh->curr);
s_destroy(msh);
exit(ret);
@@ -64,7 +68,6 @@ static void
int32_t status;
int32_t ret;
- (void)ptr;
while (wait(&status) != pid)
;
ret = WEXITSTATUS(status);
@@ -75,8 +78,13 @@ static void
b_export_mute(ptr->argv + 1, msh);
else if (bu_id == FT_ID_UNSET)
msh->bu_ptr[bu_id](ptr->argv + 1, msh);
- else if (bu_id == FT_ID_EXIT && ret == 0)
+ else if (bu_id == FT_ID_ALIAS)
+ b_alias_mute(ptr->argv + 1, msh);
+ else if (bu_id == FT_ID_EXIT)
{
+ if (msh->fd == STDIN_FILENO)
+ m_dump_hist(msh);
+ s_com_destroy(&msh->com);
s_line_clear(&msh->curr);
s_destroy(msh);
exit(ret);