fix: exit code

This commit is contained in:
Camille Chauvet 2023-03-22 16:07:27 +01:00
parent b3d060874d
commit 22dc9776d6
4 changed files with 4 additions and 2 deletions

2
env/env_fill.c vendored
View File

@ -22,7 +22,7 @@ static char *ft_getkey(const char *str)
key = ft_strdup("$"); key = ft_strdup("$");
else if (ft_strncmp(str, "$?", 2) == 0) else if (ft_strncmp(str, "$?", 2) == 0)
key = ft_strdup("?"); key = ft_strdup("?");
if (str[1] == '\0') else if (str[1] == '\0')
key = ft_strdup(""); key = ft_strdup("");
else else
{ {

View File

@ -38,6 +38,7 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd)
return (-1); return (-1);
} }
} }
data->exit_code = return_code;
return (return_code); return (return_code);
} }

View File

@ -102,8 +102,9 @@ static int ft_empty_verif(const char *str)
int ft_syntax_verif(t_data *data, const char *str) int ft_syntax_verif(t_data *data, const char *str)
{ {
if (ft_empty_verif(str))
return (1);
if (ft_quote_verif(str) if (ft_quote_verif(str)
|| ft_empty_verif(str)
|| ft_pipe_is_alone(str) || ft_pipe_is_alone(str)
|| ft_special_char_dub(str)) || ft_special_char_dub(str))
{ {