reput fds into arrays

This commit is contained in:
mdev9
2024-04-13 13:44:56 +02:00
parent 90e569f231
commit 6ea24e899f
5 changed files with 31 additions and 37 deletions

View File

@ -6,13 +6,13 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */
/* Updated: 2024/04/13 12:54:23 by tomoron ### ########.fr */
/* Updated: 2024/04/13 13:42:07 by babonnet ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void redirect_input(t_msh *msh)
void redirect_input(t_msh *msh, int i)
{
if (msh->in_type != PIPE)
{
@ -22,14 +22,9 @@ void redirect_input(t_msh *msh)
}
else
{
printf("in_fd : %d\n", msh->in_fd);
printf("cmd : %s\n", msh->cmds->value);
is_fd_open(msh->in_fd);
if (dup2(msh->in_fd, 0) < 0)
{
perror("dup2");
ft_printf_fd(2, "%d: 0 -> %d\n", i, msh->fds[i - 1][0]);
if (dup2(msh->fds[i - 1][0], 0) < 0)
ft_exit(msh, 1);
}
}
}