summaryrefslogtreecommitdiffstats
path: root/src/b_export_next.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/b_export_next.c')
-rw-r--r--src/b_export_next.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/b_export_next.c b/src/b_export_next.c
index c46389a..1fc732e 100644
--- a/src/b_export_next.c
+++ b/src/b_export_next.c
@@ -13,6 +13,7 @@
#include <libft.h>
#include <stdlib.h>
+#include "d_define.h"
#include "b_export_next.h"
#include "f_fail.h"
#include "s_lvars.h"
@@ -21,8 +22,7 @@
#include "u_vars.h"
static char
- **b_get_var(const char arg[],
- t_msh *msh)
+ **b_get_var(const char arg[], t_msh *msh)
{
size_t len;
char **var;
@@ -44,8 +44,7 @@ static char
}
static int64_t
- b_is_it_in_env(const char varname[],
- t_msh *msh)
+ b_is_it_in_env(const char varname[], t_msh *msh)
{
char **env_dup;
size_t i;
@@ -66,8 +65,7 @@ static int64_t
}
static void
- b_add_to_env(const char arg[],
- t_msh *msh)
+ b_add_to_env(const char arg[], t_msh *msh)
{
size_t i;
char **nenvp;
@@ -92,21 +90,23 @@ static void
}
void
- b_export_with_equals(const char arg[],
- t_msh *msh)
+ b_export_with_equals(const char arg[], t_msh *msh)
{
- char *varval;
+ char varval[4096];
char **var;
int64_t env_i;
+ varval[0] = C_NUL;
var = b_get_var(arg, msh);
if ((env_i = b_is_it_in_env(var[FT_VAR_NAME] + 1, msh)) != -1)
{
ft_memdel((void*)&msh->envp[env_i]);
if ((msh->envp[env_i] = ft_strdup(arg)) == NULL)
f_alloc_and_destroy_msh(msh);
+ return ;
}
- else if ((varval = u_get_cstm_vr(var[FT_VAR_NAME], msh)) != NULL)
+ u_get_custom_var(varval, var[FT_VAR_NAME], 4096, msh);
+ if (varval[0] != C_NUL)
{
b_add_to_env(arg, msh);
lvars_delone(&msh->vars, var[FT_VAR_NAME] + 1);