|
@@ -19,7 +19,7 @@ void open_left_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
|
|
|
dup(p->fd[p->i][0]);
|
|
|
}
|
|
|
else if (ft_strcmp(t->operator, "<<") == 0)
|
|
|
- prompt_redirection(e, p, t);
|
|
|
+ prompt_redirection(e, p, t, NULL);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -31,15 +31,14 @@ void open_left_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
|
|
|
|
|
|
void open_right_redirections(t_e *e, t_pipe *p, t_pipe_redir *t)
|
|
|
{
|
|
|
- int fd_file;
|
|
|
-
|
|
|
if (t->ofd == -100)
|
|
|
{
|
|
|
if (ft_strstr(t->operator, ">>") != NULL)
|
|
|
- fd_file = open(t->otxt, O_APPEND | O_WRONLY | O_CREAT, 0644);
|
|
|
+ e->fd_file = open(t->otxt, O_APPEND | O_WRONLY | O_CREAT, 0644);
|
|
|
else
|
|
|
- fd_file = open(t->otxt, O_TRUNC | O_WRONLY | O_CREAT, 0644);
|
|
|
- t->ifd == 2 ? dup2(fd_file, STDERR) : dup2(fd_file, STDOUT);
|
|
|
+ e->fd_file = open(t->otxt, O_TRUNC | O_WRONLY | O_CREAT, 0644);
|
|
|
+ e->fdout = t->ifd == 2 ? dup(STDERR) : dup(STDOUT);
|
|
|
+ t->ifd == 2 ? dup2(e->fd_file, STDERR) : dup2(e->fd_file, STDOUT);
|
|
|
}
|
|
|
else
|
|
|
{
|