glhf marijn

This commit is contained in:
2024-04-02 13:51:57 +02:00
parent a1fa344ef0
commit 0ebdfd7d34
2 changed files with 2 additions and 36 deletions

View File

@ -6,30 +6,12 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:22:15 by marde-vr #+# #+# */
/* Updated: 2024/04/02 02:02:02 by tomoron ### ########.fr */
/* Updated: 2024/04/02 13:48:48 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int get_cmd_count(t_token *cmds)
{
int count;
t_token *cur_cmd;
count = 0;
cur_cmd = cmds;
while (cur_cmd->next)
{
if (/*cur_cmd->type != PIPE*/ 1)
count++;
cur_cmd = cur_cmd->next;
}
if (/*cur_cmd->type != PIPE */ 1)
count++;
return (count);
}
int get_args_count(t_token *cmds)
{
int count;

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 13:50:14 by tomoron #+# #+# */
/* Updated: 2024/04/02 13:31:55 by tomoron ### ########.fr */
/* Updated: 2024/04/02 13:51:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -117,19 +117,3 @@ void end_execution(t_msh *msh, int cmd_count)
signal(SIGQUIT, signal_handler_interactive);
set_echoctl(0);
}
void exec_commands(t_msh *msh)
{
int cmd_count;
int i;
i = -1;
cmd_count = get_cmd_count(msh->cmds);
ft_printf("cmd_count: %d\n", cmd_count);
msh->pids = ft_calloc(cmd_count, sizeof(int *));
if (!msh->pids)
ft_exit(msh, 1);
while (++i < cmd_count)
exec_command(msh, i, cmd_count);
end_execution(msh, cmd_count);
}