From 06217e697520e5c97393bc06b89fda073efa7ea6 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 1 Sep 2020 16:40:05 +0200 Subject: Update --- src/s_com.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 550616c..75a5040 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -14,6 +14,7 @@ #include #include "f_fail.h" +#include "p_args.h" #include "p_lcom.h" #include "p_lcom_next.h" #include "s_struct.h" @@ -113,7 +114,7 @@ t_com com->env_fork = NULL; if (get_redir(word, &com) != 0) return (NULL); - if ((words = p_subst_args(word, com->redir)) == NULL) + if ((words = p_split_args(word, com->redir)) == NULL) return (NULL); if ((words = p_subst_vars(words, msh)) == NULL) return (NULL); -- cgit v1.2.3 From d5a11fcb60022edfc96bf83c9ab8cdb03e6b762a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 1 Sep 2020 16:44:52 +0200 Subject: Cool --- src/s_com.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 75a5040..99b3158 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -116,6 +116,7 @@ t_com return (NULL); if ((words = p_split_args(word, com->redir)) == NULL) return (NULL); + /* TODO: subst vars is before getting words fuck my life */ if ((words = p_subst_vars(words, msh)) == NULL) return (NULL); if ((words = p_subst_home(words, msh)) == NULL) -- cgit v1.2.3 From 4543c3ba3222d47780ad3e091cfe6f3098cc2bca Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 6 Sep 2020 21:56:20 +0200 Subject: Stacked --- src/s_com.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 99b3158..ac23f35 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -112,12 +112,11 @@ t_com com->rdrfd = 0; com->rdrpath = NULL; com->env_fork = NULL; - if (get_redir(word, &com) != 0) + if (p_get_redir(word, &com) != 0) return (NULL); - if ((words = p_split_args(word, com->redir)) == NULL) + if ((word = p_subst_vars(word, msh)) == NULL) return (NULL); - /* TODO: subst vars is before getting words fuck my life */ - if ((words = p_subst_vars(words, msh)) == NULL) + if ((words = p_split_args(word, com->redir)) == NULL) return (NULL); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); -- cgit v1.2.3 From d742075e1af0c063ef9677f157263c0d45253f73 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 8 Sep 2020 19:32:40 +0200 Subject: Rework in progress --- src/s_com.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index ac23f35..5bdb36a 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -15,8 +15,8 @@ #include "f_fail.h" #include "p_args.h" -#include "p_lcom.h" -#include "p_lcom_next.h" +#include "p_lblock.h" +#include "p_lblock_next.h" #include "s_struct.h" static int8_t -- cgit v1.2.3 From bea195a2e8d8e26af7511a65af4c8641cb4d1c4f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 10 Sep 2020 17:28:06 +0200 Subject: Even better parse --- src/s_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 5bdb36a..0f206c4 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -118,9 +118,9 @@ t_com return (NULL); if ((words = p_split_args(word, com->redir)) == NULL) return (NULL); + words = p_check_args_equals(words, msh); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); - words = p_check_args_equals(words, msh); if (msh->env_fork_tmp[0][0] != '\0') com_cpy_env_fork(&com, msh); if (fill_com(words, &com) < 0) -- cgit v1.2.3 From f2e3a002967da5077a2c6f38e97025c12f4b0986 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 10 Sep 2020 17:30:53 +0200 Subject: Quick update --- src/s_com.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 0f206c4..dc81046 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -28,7 +28,7 @@ static int8_t uint64_t j; i = 0; - if (words[0]) + if (words[0] != NULL) { if (((*com)->bin = (char*)malloc((ft_strlen(words[0]) + 1) * sizeof(char))) == NULL) @@ -59,7 +59,7 @@ static int8_t } static void - com_cpy_env_fork(t_com **com, + s_com_cpy_env_fork(t_com **com, t_msh *msh) { size_t i; @@ -118,11 +118,11 @@ t_com return (NULL); if ((words = p_split_args(word, com->redir)) == NULL) return (NULL); - words = p_check_args_equals(words, msh); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); + words = p_check_args_equals(words, msh); if (msh->env_fork_tmp[0][0] != '\0') - com_cpy_env_fork(&com, msh); + s_com_cpy_env_fork(&com, msh); if (fill_com(words, &com) < 0) { ft_delwords(words); -- cgit v1.2.3 From f165808b1cb551cd86655268b8dfa4fb7dcd5eb7 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 10 Sep 2020 18:13:47 +0200 Subject: FIX --- src/s_com.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index dc81046..36018ef 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -20,8 +20,7 @@ #include "s_struct.h" static int8_t - fill_com(char *words[], - t_com **com) + fill_com(char *words[], t_com **com) { /* TODO: norme */ uint64_t i; @@ -59,8 +58,7 @@ static int8_t } static void - s_com_cpy_env_fork(t_com **com, - t_msh *msh) + s_com_cpy_env_fork(t_com **com, t_msh *msh) { size_t i; size_t j; @@ -120,6 +118,7 @@ t_com return (NULL); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); + ft_printf("%s\n", *words); words = p_check_args_equals(words, msh); if (msh->env_fork_tmp[0][0] != '\0') s_com_cpy_env_fork(&com, msh); -- cgit v1.2.3 From 9e7db36f7afe68a75911d425d496b5e1e9910abe Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 10 Sep 2020 18:14:01 +0200 Subject: Removed debug printf --- src/s_com.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 36018ef..95f2d94 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -118,7 +118,6 @@ t_com return (NULL); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); - ft_printf("%s\n", *words); words = p_check_args_equals(words, msh); if (msh->env_fork_tmp[0][0] != '\0') s_com_cpy_env_fork(&com, msh); -- cgit v1.2.3 From 6f756ee6112c723cfe0f8ece2d530b249aa47e00 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 11 Sep 2020 15:05:31 +0200 Subject: Fix --- src/s_com.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 95f2d94..ee55c58 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -96,8 +96,7 @@ void } t_com - *s_com_new(char word[], - t_msh *msh) + *s_com_new(char word[], t_msh *msh) { t_com *com; char **words; @@ -114,6 +113,7 @@ t_com return (NULL); if ((word = p_subst_vars(word, msh)) == NULL) return (NULL); + msh->curr->lblock = word; if ((words = p_split_args(word, com->redir)) == NULL) return (NULL); if ((words = p_subst_home(words, msh)) == NULL) -- cgit v1.2.3 From a1120710a40fd1ac8fae1d68da9c3fe3fb407da2 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 11 Sep 2020 15:27:54 +0200 Subject: TODO update --- src/s_com.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index ee55c58..6d6ee09 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -20,7 +20,7 @@ #include "s_struct.h" static int8_t - fill_com(char *words[], t_com **com) + s_fill_com(char *words[], t_com **com) { /* TODO: norme */ uint64_t i; @@ -121,7 +121,7 @@ t_com words = p_check_args_equals(words, msh); if (msh->env_fork_tmp[0][0] != '\0') s_com_cpy_env_fork(&com, msh); - if (fill_com(words, &com) < 0) + if (s_fill_com(words, &com) < 0) { ft_delwords(words); return (NULL); -- cgit v1.2.3 From b2ffd2aeb4a91501ae7931cb43a9679b01eb0351 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 11 Sep 2020 16:25:51 +0200 Subject: Nice fix --- src/s_com.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 6d6ee09..277d996 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -12,7 +12,9 @@ #include #include +#include +#include "d_define.h" #include "f_fail.h" #include "p_args.h" #include "p_lblock.h" @@ -98,6 +100,7 @@ void t_com *s_com_new(char word[], t_msh *msh) { + char nword[ARG_MAX]; t_com *com; char **words; @@ -109,12 +112,12 @@ t_com com->rdrfd = 0; com->rdrpath = NULL; com->env_fork = NULL; - if (p_get_redir(word, &com) != 0) + nword[0] = C_NUL; + ft_strlcpy(nword, word, ARG_MAX); + if (p_get_redir(nword, &com) != 0) return (NULL); - if ((word = p_subst_vars(word, msh)) == NULL) - return (NULL); - msh->curr->lblock = word; - if ((words = p_split_args(word, com->redir)) == NULL) + p_subst_vars(nword, msh); + if ((words = p_split_args(nword, com->redir)) == NULL) return (NULL); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); -- cgit v1.2.3 From be1403ef70e51442df459b1ef89f547cbc9af4ca Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 11 Sep 2020 19:32:47 +0200 Subject: This shit is killing me --- src/s_com.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 277d996..51b2500 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -117,11 +117,12 @@ t_com if (p_get_redir(nword, &com) != 0) return (NULL); p_subst_vars(nword, msh); + p_check_args_equals(nword, msh); + p_subst_alias(nword, msh); if ((words = p_split_args(nword, com->redir)) == NULL) return (NULL); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); - words = p_check_args_equals(words, msh); if (msh->env_fork_tmp[0][0] != '\0') s_com_cpy_env_fork(&com, msh); if (s_fill_com(words, &com) < 0) -- cgit v1.2.3 From ff845bada3fe6898a228c10422f0561e2a532622 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 11 Sep 2020 21:18:27 +0200 Subject: Fuck this --- src/s_com.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 51b2500..4d78573 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -116,13 +116,13 @@ t_com ft_strlcpy(nword, word, ARG_MAX); if (p_get_redir(nword, &com) != 0) return (NULL); - p_subst_vars(nword, msh); - p_check_args_equals(nword, msh); p_subst_alias(nword, msh); + p_subst_vars(nword, msh); if ((words = p_split_args(nword, com->redir)) == NULL) return (NULL); if ((words = p_subst_home(words, msh)) == NULL) return (NULL); + words = p_check_args_equals(words, msh); if (msh->env_fork_tmp[0][0] != '\0') s_com_cpy_env_fork(&com, msh); if (s_fill_com(words, &com) < 0) -- cgit v1.2.3 From 8b15c7b0f233238a53088d8c095bd5af7f7592e7 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 12 Sep 2020 14:51:23 +0200 Subject: how tf will I norm this --- src/s_com.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index 4d78573..b85905e 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -116,7 +116,8 @@ t_com ft_strlcpy(nword, word, ARG_MAX); if (p_get_redir(nword, &com) != 0) return (NULL); - p_subst_alias(nword, msh); + /* if (msh->alias != NULL) */ + p_subst_alias(nword, msh); p_subst_vars(nword, msh); if ((words = p_split_args(nword, com->redir)) == NULL) return (NULL); -- cgit v1.2.3 From 477ea057edf32486e944ef4e33023e9ab6636e07 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 12 Sep 2020 15:07:22 +0200 Subject: Aliases work, fucker --- src/s_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index b85905e..a5c594a 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -116,7 +116,7 @@ t_com ft_strlcpy(nword, word, ARG_MAX); if (p_get_redir(nword, &com) != 0) return (NULL); - /* if (msh->alias != NULL) */ + if (msh->alias != NULL) p_subst_alias(nword, msh); p_subst_vars(nword, msh); if ((words = p_split_args(nword, com->redir)) == NULL) -- cgit v1.2.3 From 949f93b57b6411b07eb12110e0db37cdf393db0c Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 12 Sep 2020 16:33:02 +0200 Subject: Fuck --- src/s_com.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index a5c594a..b899555 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -103,6 +103,7 @@ t_com char nword[ARG_MAX]; t_com *com; char **words; + size_t ret; if ((com = (t_com*)malloc(sizeof(t_com))) == NULL) return (NULL); @@ -117,7 +118,11 @@ t_com if (p_get_redir(nword, &com) != 0) return (NULL); if (msh->alias != NULL) - p_subst_alias(nword, msh); + { + ret = p_subst_alias(nword, TRUE, msh); + while (ret != 0) + ret = p_subst_alias(nword, TRUE, msh); + } p_subst_vars(nword, msh); if ((words = p_split_args(nword, com->redir)) == NULL) return (NULL); -- cgit v1.2.3 From 3f726e2433438176a6b7f73df7d6bf51a185c5b2 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 12 Sep 2020 18:11:56 +0200 Subject: Fix --- src/s_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/s_com.c') diff --git a/src/s_com.c b/src/s_com.c index b899555..28b460f 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -121,7 +121,7 @@ t_com { ret = p_subst_alias(nword, TRUE, msh); while (ret != 0) - ret = p_subst_alias(nword, TRUE, msh); + ret = p_subst_alias(nword, FALSE, msh); } p_subst_vars(nword, msh); if ((words = p_split_args(nword, com->redir)) == NULL) -- cgit v1.2.3