summaryrefslogtreecommitdiffstats
path: root/src/b_export_next.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-10 17:56:38 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-10 17:56:38 +0200
commit4b233e06a16bf5183223e8253b4d9ac9ee59e6a2 (patch)
treedc36a64dcad37e076f478aadc7cccb0f322ea192 /src/b_export_next.c
parentpwd TODO done (diff)
download42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.gz
42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.bz2
42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.xz
42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.tar.zst
42-minishell-4b233e06a16bf5183223e8253b4d9ac9ee59e6a2.zip
Work in progress
Diffstat (limited to 'src/b_export_next.c')
-rw-r--r--src/b_export_next.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/b_export_next.c b/src/b_export_next.c
index 7b70047..90a4820 100644
--- a/src/b_export_next.c
+++ b/src/b_export_next.c
@@ -28,17 +28,17 @@ static char
char **var;
if ((var = (char**)malloc(3 * sizeof(char*))) == NULL)
- f_fail_alloc_and_destroy(msh);
+ f_alloc_and_destroy_msh(msh);
len = 0;
while (arg[len] != '=' && arg[len] != '\0')
len++;
len += 1;
if ((var[FT_VAR_NAME] = (char*)malloc((len + 1) * sizeof(char))) == NULL)
- f_fail_alloc_and_destroy(msh);
+ f_alloc_and_destroy_msh(msh);
var[FT_VAR_NAME][0] = '$';
ft_strlcpy(var[FT_VAR_NAME] + 1, arg, len);
if ((var[FT_VAR_VAL] = ft_strdup(arg + len)) == NULL)
- f_fail_alloc_and_destroy(msh);
+ f_alloc_and_destroy_msh(msh);
var[FT_VAR_NULL] = NULL;
return (var);
}
@@ -75,16 +75,16 @@ static void
while (msh->envp[i] != NULL)
i++;
if (!(nenvp = (char**)malloc((i + 2) * sizeof(char*))))
- f_fail_alloc_and_destroy(msh);
+ f_alloc_and_destroy_msh(msh);
i = 0;
while (msh->envp[i] != NULL)
{
if (!(nenvp[i] = ft_strdup(msh->envp[i])))
- f_fail_alloc_and_destroy(msh);
+ f_alloc_and_destroy_msh(msh);
i++;
}
if (!(nenvp[i] = ft_strdup(arg)))
- f_fail_alloc_and_destroy(msh);
+ f_alloc_and_destroy_msh(msh);
nenvp[i + 1] = 0;
ft_delwords(msh->envp);
msh->envp = nenvp;
@@ -103,7 +103,7 @@ void
{
ft_memdel((void*)&msh->envp[env_i]);
if ((msh->envp[env_i] = ft_strdup(arg)) == NULL)
- f_fail_alloc_and_destroy(msh);
+ f_alloc_and_destroy_msh(msh);
}
else if ((varval = u_get_cstm_vr(var[FT_VAR_NAME], msh)) != NULL)
{