"cmd_arr/cmd_array" renamed to "pipeline"
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
|
||||
/* Updated: 2021/11/18 13:29:25 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/11/29 12:26:08 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -18,7 +18,7 @@ int exec_cmd_line(t_all *c)
|
||||
{
|
||||
if (!pipeline(c))
|
||||
{
|
||||
free_pipeline(&c->cmd_arr);
|
||||
free_pipeline(&c->pipeline);
|
||||
return (0);
|
||||
}
|
||||
return (1);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
|
||||
/* Updated: 2021/11/27 10:48:13 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/11/29 12:26:27 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -18,15 +18,15 @@ static pid_t pipeline_exec(t_cmd *pipeline[], t_all *c);
|
||||
|
||||
int pipeline(t_all *c)
|
||||
{
|
||||
if (!open_pipes(c->cmd_arr))
|
||||
if (!open_pipes(c->pipeline))
|
||||
return (0);
|
||||
if (!pipeline_find_access(c->cmd_arr, c->path))
|
||||
if (!pipeline_find_access(c->pipeline, c->path))
|
||||
return (0);
|
||||
if (ft_2d_arrlen(c->cmd_arr) == 1 && c->cmd_arr[0]->builtin_func)
|
||||
simple_command_builtin(c->cmd_arr[0], c);
|
||||
if (ft_2d_arrlen(c->pipeline) == 1 && c->pipeline[0]->builtin_func)
|
||||
simple_command_builtin(c->pipeline[0], c);
|
||||
else
|
||||
wait_subshell(pipeline_exec(c->cmd_arr, c));
|
||||
free_pipeline(&c->cmd_arr);
|
||||
wait_subshell(pipeline_exec(c->pipeline, c));
|
||||
free_pipeline(&c->pipeline);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ static pid_t pipeline_exec(t_cmd *pipeline[], t_all *c)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
close_pipeline_fd(c->cmd_arr);
|
||||
close_pipeline_fd(c->pipeline);
|
||||
i -= 1;
|
||||
if (pipeline[i]->error)
|
||||
set_last_exit_status(pipeline[i]->error);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
|
||||
/* Updated: 2021/11/27 11:11:12 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/11/29 12:26:33 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -27,7 +27,7 @@ int cmd_exec_in_subshell(t_cmd *cmd, t_all *c)
|
||||
if (cmd->fd_out != STDOUT_FILENO)
|
||||
if (dup2(cmd->fd_out, STDOUT_FILENO) == -1)
|
||||
return (ft_reti_perror(EXIT_FAILURE, "dup2()"));
|
||||
close_pipeline_fd(c->cmd_arr);
|
||||
close_pipeline_fd(c->pipeline);
|
||||
if (cmd->builtin_func)
|
||||
free_exit(c, cmd->builtin_func(ft_2d_arrlen(cmd->argv), cmd->argv, c));
|
||||
else if (execve(cmd->path, cmd->argv, environ) == -1)
|
||||
|
||||
Reference in New Issue
Block a user