broke outfile redirects
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/02/07 14:12:49 by tomoron #+# #+# */
|
/* Created: 2024/02/07 14:12:49 by tomoron #+# #+# */
|
||||||
/* Updated: 2024/03/04 13:40:17 by marde-vr ### ########.fr */
|
/* Updated: 2024/03/05 08:26:12 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ int get_args_count(t_cmd *cmds)
|
|||||||
if (cur_cmd->type == ARG)
|
if (cur_cmd->type == ARG)
|
||||||
count++;
|
count++;
|
||||||
else
|
else
|
||||||
cur_cmd = cur_cmd->next->next;
|
cur_cmd = cur_cmd->next;
|
||||||
}
|
}
|
||||||
if (cur_cmd->type == ARG)
|
if (cur_cmd->type == ARG)
|
||||||
count++;
|
count++;
|
||||||
@ -188,6 +188,7 @@ void pipe_child(t_msh *msh, char **cmd_args, int i)
|
|||||||
//ft_printf_fd(2, "redirecting input of %s of type %d with fd %d\n", msh->cmds->token, msh->in_type, msh->in_fd);
|
//ft_printf_fd(2, "redirecting input of %s of type %d with fd %d\n", msh->cmds->token, msh->in_type, msh->in_fd);
|
||||||
redirect_input(msh, i);
|
redirect_input(msh, i);
|
||||||
}
|
}
|
||||||
|
//ft_printf_fd(2, "output of %s of type %d with fd %d\n", msh->cmds->token, msh->out_type, msh->out_fd);
|
||||||
if (msh->out_type == PIPE || msh->out_type == RED_O || msh->out_type == RED_O_APP)
|
if (msh->out_type == PIPE || msh->out_type == RED_O || msh->out_type == RED_O_APP)
|
||||||
{
|
{
|
||||||
//ft_printf_fd(2, "redirecting output of %s of type %d with fd %d\n", msh->cmds->token, msh->out_type, msh->out_fd);
|
//ft_printf_fd(2, "redirecting output of %s of type %d with fd %d\n", msh->cmds->token, msh->out_type, msh->out_fd);
|
||||||
@ -301,7 +302,7 @@ char **get_cmd_args(t_msh *msh)
|
|||||||
if (cur_cmd->type == ARG)
|
if (cur_cmd->type == ARG)
|
||||||
{
|
{
|
||||||
cmd_args[i] = cur_cmd->token;
|
cmd_args[i] = cur_cmd->token;
|
||||||
ft_printf_fd(2, "%s[%d] = %s\n", msh->cmds->token, i, cur_cmd->token);
|
//ft_printf_fd(2, "%s[%d] = %s\n", msh->cmds->token, i, cur_cmd->token);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -391,7 +392,7 @@ void get_out_type(t_msh *msh)
|
|||||||
msh->out_type = ARG;
|
msh->out_type = ARG;
|
||||||
msh->out_fd = 0;
|
msh->out_fd = 0;
|
||||||
cur_cmd = msh->cmds;
|
cur_cmd = msh->cmds;
|
||||||
while (cur_cmd && cur_cmd->next && cur_cmd->type == ARG)
|
while (cur_cmd && cur_cmd->next && cur_cmd->type != ARG) //PIPE?
|
||||||
cur_cmd = cur_cmd->next;
|
cur_cmd = cur_cmd->next;
|
||||||
if (!cur_cmd->type)
|
if (!cur_cmd->type)
|
||||||
msh->out_type = ARG;
|
msh->out_type = ARG;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */
|
/* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */
|
||||||
/* Updated: 2024/03/04 13:39:15 by marde-vr ### ########.fr */
|
/* Updated: 2024/03/05 08:02:22 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
msh->cmds = parse_command(command, msh->env);
|
msh->cmds = parse_command(command, msh->env);
|
||||||
free(command);
|
free(command);
|
||||||
msh->cmds = handle_alias(msh);
|
msh->cmds = handle_alias(msh);
|
||||||
print_parsed_cmd(msh->cmds); // debug
|
//print_parsed_cmd(msh->cmds); // debug
|
||||||
exec_command(msh);
|
exec_command(msh);
|
||||||
free_cmd(msh->cmds);
|
free_cmd(msh->cmds);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user