32 lines
1.3 KiB
C
32 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* :::::::: */
|
|
/* executor_count_fds.c :+: :+: */
|
|
/* +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
|
/* +#+ */
|
|
/* Created: 2025/02/21 12:42:26 by whaffman #+# #+# */
|
|
/* Updated: 2025/02/26 16:09:45 by whaffman ######## odam.nl */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
int executor_count_fds(t_minishell *msh)
|
|
{
|
|
int count;
|
|
t_list *current;
|
|
t_command *command;
|
|
|
|
current = msh->commands;
|
|
count = (ft_lstsize(current) - 1) * 2;
|
|
while (current)
|
|
{
|
|
command = (t_command *)current->content;
|
|
count += ft_lstsize(command->redirect_in);
|
|
count += ft_lstsize(command->redirect_out);
|
|
current = current->next;
|
|
}
|
|
return (count);
|
|
}
|