summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 20:02:35 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 20:02:35 +0200
commit6ae7b0154905e2a096a3953e11c0fdbb3f1a199f (patch)
tree36b6f8dca7381af9194a3c69acac3727e3433c7b
parenty a du taff (diff)
download42-minishell-6ae7b0154905e2a096a3953e11c0fdbb3f1a199f.tar.gz
42-minishell-6ae7b0154905e2a096a3953e11c0fdbb3f1a199f.tar.bz2
42-minishell-6ae7b0154905e2a096a3953e11c0fdbb3f1a199f.tar.xz
42-minishell-6ae7b0154905e2a096a3953e11c0fdbb3f1a199f.tar.zst
42-minishell-6ae7b0154905e2a096a3953e11c0fdbb3f1a199f.zip
I am happy
-rw-r--r--src/ft_e_externs.c2
-rw-r--r--src/ft_s_lcom.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/src/ft_e_externs.c b/src/ft_e_externs.c
index eb8cfed..448a243 100644
--- a/src/ft_e_externs.c
+++ b/src/ft_e_externs.c
@@ -61,7 +61,7 @@ ft_e_extern_child(const char *fullpath,
int32_t ret;
ft_dup_redirs(ptr, msh);
- ret = execve(fullpath, ptr->argv, NULL);
+ ret = execve(fullpath, ptr->argv, msh->envp);
/* TODO: handle execve failed */
ft_lcom_clear(&msh->curr);
ft_s_destroy(msh);
diff --git a/src/ft_s_lcom.c b/src/ft_s_lcom.c
index 0f6f750..de09e5c 100644
--- a/src/ft_s_lcom.c
+++ b/src/ft_s_lcom.c
@@ -20,6 +20,7 @@ static int8_t
ft_fill_lcom(char *words[],
t_lcom **lcom)
{
+ /* TODO: norme */
uint64_t i;
uint64_t j;
@@ -28,10 +29,10 @@ static int8_t
sizeof(char))))
return (-1);
ft_strlcpy((*lcom)->com, words[0], ft_strlen(words[0]) + 1);
- while(words[i + 1])
+ while(words[i])
{
/* TODO: better <> cut ex: "msh ~> echo qwe>qwe" | gl hf */
- if (ft_ischarset("<>", words[i + 1][0]))
+ if (ft_ischarset("<>", words[i][0]))
break ;
i++;
}
@@ -41,10 +42,10 @@ static int8_t
while (i > 0 && j < i)
{
if (!((*lcom)->argv[j] =
- (char*)malloc((ft_strlen(words[j + 1]) + 1) * sizeof(char))))
+ (char*)malloc((ft_strlen(words[j]) + 1) * sizeof(char))))
return (-1);
- ft_strlcpy((*lcom)->argv[j], words[j + 1],
- ft_strlen(words[j + 1]) + 1);
+ ft_strlcpy((*lcom)->argv[j], words[j],
+ ft_strlen(words[j]) + 1);
j++;
}
(*lcom)->argv[j] = 0;