summaryrefslogtreecommitdiffstats
path: root/src/p_lcom_next.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-10 19:06:30 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-10 19:06:30 +0200
commitd9d98feb999b6f503b5ca330976dc30266016551 (patch)
tree5763beb8ffddfdf8a562f5a2c8507a3467c4f885 /src/p_lcom_next.c
parentWork in progress (diff)
download42-minishell-d9d98feb999b6f503b5ca330976dc30266016551.tar.gz
42-minishell-d9d98feb999b6f503b5ca330976dc30266016551.tar.bz2
42-minishell-d9d98feb999b6f503b5ca330976dc30266016551.tar.xz
42-minishell-d9d98feb999b6f503b5ca330976dc30266016551.tar.zst
42-minishell-d9d98feb999b6f503b5ca330976dc30266016551.zip
Pretty damn good one-tap vars
Diffstat (limited to '')
-rw-r--r--src/p_lcom_next.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/p_lcom_next.c b/src/p_lcom_next.c
index e461d55..9a39dd0 100644
--- a/src/p_lcom_next.c
+++ b/src/p_lcom_next.c
@@ -178,32 +178,17 @@ static char
static void
p_add_to_env_fork(int64_t i,
char *words[],
- t_lcom *ptr,
t_msh *msh)
{
int64_t j;
- (void)msh;
- (void)words;
j = 0;
- if ((ptr->env_fork = (char**)malloc((i + 1) * sizeof(char*))) == NULL)
- {
- ft_delwords(words);
- f_alloc_and_destroy_msh(msh);
- }
while(j < i)
{
- if ((ptr->env_fork[j] = ft_strdup(words[j])) == NULL)
- f_alloc_and_destroy_msh(msh);
+ ft_strlcpy(msh->env_fork_tmp[j], words[j], ft_strlen(words[j]) + 1);
j++;
}
- ptr->env_fork[j] = NULL;
- /* TODO: delete this */
- i = 0;
- while (ptr->env_fork[i] != NULL) {
- ft_printf("[%s]\n", ptr->env_fork[i]);
- }
- ft_printf("[%s]\n", ptr->env_fork[i]);
+ msh->env_fork_tmp[j][0] = '\0';
}
char
@@ -234,7 +219,9 @@ char
if (i == 0)
isvar = FALSE;
if (isvar == TRUE)
- p_add_to_env_fork(i, words, msh->curr, msh);
+ p_add_to_env_fork(i, words, msh);
+ else
+ msh->env_fork_tmp[0][0] = '\0';
break ;
}
i++;