|
@@ -82,6 +82,35 @@ void inside_pipe(t_e *e, t_pipe *p, t_pipe_redir *t)
|
|
|
close_redirections(e, p, t);
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+** Special function to handle double redirections of fd and execution fork
|
|
|
+** fork, open left and right redirections
|
|
|
+** execute cmd, close fd, father wait for end of son fork
|
|
|
+*/
|
|
|
+
|
|
|
+void launch_double_redirections(t_e *e, t_pipe *p, t_pipe_redir **t)
|
|
|
+{
|
|
|
+ int fd;
|
|
|
+
|
|
|
+ if (ft_strcmp(t[0]->operator, "<<") == 0)
|
|
|
+ {
|
|
|
+ prompt_redirection(e, p, t[0]);
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ else if (fork() == 0)
|
|
|
+ {
|
|
|
+ fd = open(t[0]->otxt, O_RDONLY);
|
|
|
+ close(0);
|
|
|
+ dup(fd);
|
|
|
+ open_right_redirections(e, p, t[1]);
|
|
|
+ manage_cmd_2(e, cmd_splitting(e, t[0]->itxt, ' '));
|
|
|
+ close(STDOUT);
|
|
|
+ close(fd);
|
|
|
+ exit(0);
|
|
|
+ }
|
|
|
+ wait(NULL);
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
** check every cmd, every cote type
|
|
|
** if block starts and ends with same cote:
|