refactoring parsing (wip)

This commit is contained in:
LuckyLaszlo
2021-12-11 04:27:57 +01:00
parent 9322ec9ec9
commit d3d55386d9
4 changed files with 48 additions and 36 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/24 10:52:40 by lperrey #+# #+# */
/* Updated: 2021/12/06 01:08:11 by lperrey ### ########.fr */
/* Updated: 2021/12/10 19:58:17 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -52,25 +52,22 @@ t_cmd **parsing(t_token *token_list)
// 2.9.1 - 1) Save Words
save_redirections_words(token_list);
// 2.9.1 - 2) Expansion
// TEST TOKENS PRINT
//ft_putstr_fd("TOKENS LIST :\n-----------\n", 1);
//ft_lstprint((t_list *)token_list, 1);
//
// getenv() ne va pas fonctionner avec le changement d'environnement prévu jusqu'ici.
// TODO : Revoir le changement d'environnement (avec extern char **environ ?)
// OU Integrer un equivalent perso comme dans pipex
if (!words_expansions(token_list))
return (NULL);
//
//ft_putstr_fd("TOKENS LIST EXPANDED :\n-----------\n", 1);
//ft_lstprint((t_list *)token_list, 1);
// Struct CMD alloc
pipeline = pipeline_alloc(1 + count_pipes(token_list));
if (!pipeline)
return (NULL);
// 2.9.1 - 2) Expansion
// TEST TOKENS PRINT
/* ft_putstr_fd("TOKENS LIST :\n-----------\n", STDERR_FILENO);
ft_lstprint((t_list *)token_list, STDERR_FILENO); */
//
if (!expansions(token_list, pipeline))
return (ft_retp_free(NULL, &pipeline, (t_free_f)free_pipeline));
//
/* ft_putstr_fd("TOKENS LIST EXPANDED :\n-----------\n", STDERR_FILENO);
ft_lstprint((t_list *)token_list, STDERR_FILENO); */
// 2.9.1 - 3) Redirection
if (!redirections(token_list, pipeline))
return (ft_retp_free(NULL, &pipeline, (t_free_f)free_pipeline));