summaryrefslogtreecommitdiffstats
path: root/src/ft_s_lcom.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-26 17:18:16 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-26 17:18:16 +0200
commit75492244a377c8d5d61459a162d73d60dd32759e (patch)
treec1d86b502143a97a7fde36db303bdab4a62ae2dd /src/ft_s_lcom.c
parentTodo update (diff)
download42-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 'src/ft_s_lcom.c')
-rw-r--r--src/ft_s_lcom.c24
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);