faboussard / 42_minishell

1 stars 0 forks source link

Total command always 1 #25

Closed melobern closed 5 months ago

melobern commented 5 months ago

Screenshot from 2024-04-04 15-09-04

Minishell>$ ls - l | wc -l | wc - l total command is 1

melobern commented 5 months ago
void count_total_commands(t_minishell *minishell)
{
    t_token_list *iterator;

    minishell->total_commands = 1;
    iterator = minishell->list_tokens;
    while (iterator)
    {
        if (iterator->e_operator == PIPE)
            minishell->total_commands++;
        iterator = iterator->next;
    }
}

Fixed : iterate IF.