ckc
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/05 18:22:15 by marde-vr #+# #+# */
|
||||
/* Updated: 2024/04/06 12:18:31 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/04/07 18:40:53 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -61,7 +61,12 @@ char **get_cmd_args(t_msh *msh)
|
||||
void remove_command_from_msh(t_msh *msh)
|
||||
{
|
||||
free_token(msh->tokens);
|
||||
while(msh->cmds && is_cmd_type(msh->cmds))
|
||||
msh->cmds = msh->cmds->next;
|
||||
while(msh->cmds && !is_cmd_type(msh->cmds))
|
||||
msh->cmds = msh->cmds->next;
|
||||
msh->tokens = parse_command(msh->cmds->value, msh->env);
|
||||
if(msh->cmds)
|
||||
msh->tokens = parse_command(msh->cmds->value, msh->env);
|
||||
else
|
||||
msh->tokens = 0;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */
|
||||
/* Updated: 2024/04/04 13:48:52 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/04/07 19:51:29 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -23,7 +23,10 @@ void redirect_input(t_msh *msh)
|
||||
else
|
||||
{
|
||||
if (dup2(msh->in_fd, 0) < 0)
|
||||
{
|
||||
perror("dup2");
|
||||
ft_exit(msh, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/05 18:17:25 by marde-vr #+# #+# */
|
||||
/* Updated: 2024/04/04 13:23:51 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/04/07 18:49:09 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -25,6 +25,7 @@ void close_pipe_fds(t_msh *msh, int i)
|
||||
close(msh->out_fd);
|
||||
if (msh->in_fd > 2)
|
||||
close(msh->in_fd);
|
||||
//double close
|
||||
}
|
||||
|
||||
void execute_command(t_msh *msh, char **cmd_args)
|
||||
|
Reference in New Issue
Block a user