From fa1bce6a580d380ef779c688d6ec3f0d78c0c08b Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 23 Apr 2020 01:02:29 +0200 Subject: nigga be eating my prompt --- src/ft_e_lcom.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ft_e_lcom.c') diff --git a/src/ft_e_lcom.c b/src/ft_e_lcom.c index e8787da..acfc187 100644 --- a/src/ft_e_lcom.c +++ b/src/ft_e_lcom.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include "ft_s_struct.h" static uint8_t @@ -32,6 +34,7 @@ static uint8_t uint8_t ft_e_lcom(t_msh *msh) { + int fd; t_lcom *ptr; uint8_t bu_id; @@ -41,7 +44,13 @@ uint8_t if ((bu_id = ft_get_builtin_id(ptr->com, msh)) < FT_BUILTINS_COUNT) { + if (ptr->redir == 1 && + (fd = open(ptr->rdrpath, O_CREAT | O_WRONLY, 0644))) + { + dup2(fd, STDOUT_FILENO); + } msh->ret = msh->bu_ptr[bu_id](ptr->args, msh); + close(fd); } else { -- cgit v1.2.3