Make operators < and << work
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 1 Aug 2024 13:40:26 +0000 (15:40 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 1 Aug 2024 13:40:26 +0000 (15:40 +0200)
There was a minor confusion when the redirection was first implemented
because the usage was not yet thought about much.

src/execution.c

index f1f22312eb8cce950346b076364e9f5161f82f66..c0b835c5a04f0fdbef75e7eca0a9a2405fc5b1fa 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/07/21 08:57:54 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/01 15:16:57 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/08/01 15:30:29 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -143,7 +143,7 @@ int add_redirection_file(t_vec *redirections, t_parse_tree_node *io_file, int fd
                        free(filename);
                        return (1);
                }
-               redir = (t_redirection){.from_to_fds[0] = sec_fd, .from_to_fds[1] = fd, .created = 0};
+               redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = sec_fd, .created = 0};
        }
        else
        {
@@ -321,7 +321,7 @@ int add_redirection_here(t_vec *redirections, t_parse_tree_node *io_here, int fd
        free(delimiter);
        if (err)
                return (1);
-       redir = (t_redirection){.from_to_fds[0] = pipe_fds[0], .from_to_fds[1] = fd, .created = 1};
+       redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = pipe_fds[0], .created = 1};
        return (ft_vec_append(redirections, &redir) != success);
 }