Commit 3a7b7e9b authored by pêle-mêle's avatar pêle-mêle
Browse files

another merge :p

parents 60f6d954 1ec4a5c0
......@@ -31,4 +31,6 @@ typedef int (*t_exec)(char **args, t_xe *xe);
int execute_cmd(char **args, char **redir_paths, enum e_redir_op *redir_types, t_xe *xe);
void apply_redirs(char **redir_paths, enum e_redir_op *redir_types);
#endif
......@@ -114,14 +114,23 @@ int handle_execution(t_xe *xe, int fd_in, int proc)
cur_command = parse_one_command(xe);
if (cur_command == NULL)
return (MALLOC_ERR);
if (cur_command->redir_types != NULL && cur_command->redir_types[0] == AMBIG)
if (cur_command->redir_types != NULL)
{
free_command(cur_command);
if (ft_error(AMBIG_REDIR, xe) != SUCCESS)
return (FAILURE);
dup2(xe->backup_stdout, STDOUT_FILENO);
dup2(xe->backup_stdin, STDIN_FILENO);
return (handle_execution(xe, fd_in, proc));
if (cur_command->redir_types[0] == AMBIG)
{
free_command(cur_command);
if (ft_error(AMBIG_REDIR, xe) != SUCCESS)
return (FAILURE);
dup2(xe->backup_stdout, STDOUT_FILENO);
dup2(xe->backup_stdin, STDIN_FILENO);
return (handle_execution(xe, fd_in, proc));
}
if (cur_command->args == NULL)
{
apply_redirs(cur_command->redir_paths, cur_command->redir_types);
free_command(cur_command);
return (handle_execution(xe, fd_in, proc));
}
}
if (cur_command->args != NULL)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment