diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-26 17:18:16 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-26 17:18:16 +0200 |
commit | 75492244a377c8d5d61459a162d73d60dd32759e (patch) | |
tree | c1d86b502143a97a7fde36db303bdab4a62ae2dd /src/ft_s_lcom.c | |
parent | Todo update (diff) | |
download | 42-minishell-75492244a377c8d5d61459a162d73d60dd32759e.tar.gz 42-minishell-75492244a377c8d5d61459a162d73d60dd32759e.tar.bz2 42-minishell-75492244a377c8d5d61459a162d73d60dd32759e.tar.xz 42-minishell-75492244a377c8d5d61459a162d73d60dd32759e.tar.zst 42-minishell-75492244a377c8d5d61459a162d73d60dd32759e.zip |
Tryna subst vars
Diffstat (limited to '')
-rw-r--r-- | src/ft_s_lcom.c | 24 |
1 files changed, 23 insertions, 1 deletions
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); |