Commit 5343a684 authored by pêle-mêle's avatar pêle-mêle
Browse files

pass ambiguous redir error correctly

parent 00c04a6f
......@@ -14,6 +14,8 @@ add_to_buf malloc error!
print newline after "^C" for CTRL-C signal ("cat")
echo > $unknown_var ; ls
create file when redirecting output without doing anything ("> a")
if redirecting to variable that should be splitted
......
......@@ -177,11 +177,7 @@ int parse_input(char **line, char **env, int stat_loc, t_command *command)
command->redir_types = machine.redir_types;
command->args = machine.args;
if (*line == NULL)
{
if (machine.redir_types[0] == AMBIG)
return (AMBIG_REDIR);
return (FAILURE);
}
return (SUCCESS);
}
......@@ -196,7 +192,7 @@ t_command *parse_one_command(t_xe *xe)
ret = parse_input(&xe->line, xe->env, xe->stat_loc, cur_command);
if (ret == FAILURE)
{
free_command(cur_command); // et args, redir_paths et types
free_command(cur_command);
return (NULL);
}
return (cur_command);
......
......@@ -137,7 +137,6 @@ int add_arg(t_state_machine *machine)
&& machine->cur_arg[0] == '\0')))
{
machine->redir_types[0] = AMBIG;
return (FAILURE);
}
else if (machine->quote_state == TRUE || machine->cur_arg[0] != '\0')
{
......
Supports Markdown
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