Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benoit
minishell
Commits
5343a684
Commit
5343a684
authored
Jan 26, 2021
by
pêle-mêle
Browse files
pass ambiguous redir error correctly
parent
00c04a6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
notes.txt
View file @
5343a684
...
...
@@ -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
...
...
src/parsing/parse_input.c
View file @
5343a684
...
...
@@ -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
);
...
...
src/parsing/parse_utils.c
View file @
5343a684
...
...
@@ -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'
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment