This commit is contained in:
Camille Chauvet
2023-03-13 15:34:43 +01:00
parent b1d827e106
commit 74bbbd899a
6 changed files with 12 additions and 18 deletions

View File

@ -1,9 +1,8 @@
#include "./parse_private.h"
int ft_args_parse(t_data *data, char *cmd_str, t_cmd *cmd)
static int ft_args_parse(char *cmd_str, t_cmd *cmd)
{
char **tab;
char *str;
size_t i;
tab = ft_split_quoted(cmd_str, ' ');
@ -12,22 +11,14 @@ int ft_args_parse(t_data *data, char *cmd_str, t_cmd *cmd)
i = 0;
while (tab[i] != NULL)
{
str = ft_env_filler(data, tab[i]);
if (str == NULL)
{
ft_freer_tab_ultimate(1, tab);
return (1);
}
ft_quote_remover(str);
free(tab[i]);
tab[i] = str;
ft_quote_remover(tab[i]);
i++;
}
cmd->args = tab;
return (0);
}
int ft_executable_parse(t_data *data, t_cmd *cmd)
static int ft_executable_parse(t_data *data, t_cmd *cmd)
{
bool own;
char *path;
@ -76,7 +67,7 @@ int ft_cmd_parser(t_data *data, char *cmd_str)
ft_cmddel(cmd);
return (1);
}
if (ft_args_parse(data, cmd_str, cmd))
if (ft_args_parse(cmd_str, cmd))
{
ft_cmddel(cmd);
return (1);