From 75492244a377c8d5d61459a162d73d60dd32759e Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 26 Apr 2020 17:18:16 +0200 Subject: Tryna subst vars --- src/ft_s_lcom.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/ft_s_lcom.c') diff --git a/src/ft_s_lcom.c b/src/ft_s_lcom.c index 03b2f67..ab63414 100644 --- a/src/ft_s_lcom.c +++ b/src/ft_s_lcom.c @@ -106,12 +106,27 @@ void *lcom = NULL; } +/* !!!!!!!!!! ATTENTION !!!!!!!!!!! */ +/* TODO: remove this after tests */ +/* !!!!!!!!!! ATTENTION !!!!!!!!!!! */ +static void +ft_print_words(char *words[]) +{ + while (*words) + { + ft_printf("[%s]\n", *words); + words++; + } +} + t_lcom - *ft_lcom_new(const char word[]) + *ft_lcom_new(const char word[], + t_msh *msh) { t_lcom *link; char **words; + (void)msh; if (!(link = (t_lcom*)malloc(sizeof(t_lcom)))) return (NULL); link->redir = 0; @@ -123,6 +138,13 @@ t_lcom return (NULL); if (!(words = ft_subst_args(word, link->redir))) return (NULL); + if (!(words = ft_subst_vars(words, msh))) + return (NULL); + /* !!!!!!!!!! ATTENTION !!!!!!!!!!! */ + /* TODO: remove this after tests */ + ft_print_words(words); + /* TODO: remove this after tests */ + /* !!!!!!!!!! ATTENTION !!!!!!!!!!! */ if (ft_fill_lcom(words, &link) < 0) { ft_delwords(words); -- cgit v1.2.3