From: Lukas Jiriste Date: Sun, 21 Jul 2024 17:56:18 +0000 (+0200) Subject: Add the actual split to fields X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=f7971e6bdf03680402fbb39f3dcc330f63c536e1;p=42%2Fminishell.git Add the actual split to fields I forgot to implement it 2 commits back and compiler does not warn because the vec is void pointer. --- diff --git a/src/execution.c b/src/execution.c index 118b070..f3a95dc 100644 --- a/src/execution.c +++ b/src/execution.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/21 08:57:54 by ljiriste #+# #+# */ -/* Updated: 2024/07/21 19:47:22 by ljiriste ### ########.fr */ +/* Updated: 2024/07/21 20:00:06 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -410,9 +410,12 @@ int expand_cmd(t_vec *exp_str, const t_parse_tree_node *node, const t_execution_ return (0); } +static const char null_char = '\0'; + char **expand(t_parse_tree_node *simple_command, const t_execution_env *env) { size_t i; + char **res; t_vec expanded_str; t_parse_tree_node *subnode; @@ -432,7 +435,19 @@ char **expand(t_parse_tree_node *simple_command, const t_execution_env *env) } ++i; } - return (expanded_str.vec); + if (ft_vec_append(&expanded_str, &null_char) != success) + { + ft_vec_free(&expanded_str, NULL); + return (NULL); + } + res = ft_split(expanded_str.vec, ' '); + ft_vec_free(&expanded_str, NULL); + return (res); +} + +int assignments_to_env(const t_vec *assignments, t_execution_env *env) +{ + } int ex_simple_command(t_parse_tree_node *simple_command, t_execution_env *env)