diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/b_export_next.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/b_export_next.c b/src/b_export_next.c index f0bb804..683fdd0 100644 --- a/src/b_export_next.c +++ b/src/b_export_next.c @@ -30,9 +30,10 @@ static char while (arg[len] != '=' && arg[len] != '\0') len++; len += 1; - if ((var[FT_VAR_NAME] = (char*)malloc((len) * sizeof(char))) == NULL) + if ((var[FT_VAR_NAME] = (char*)malloc((len + 1) * sizeof(char))) == NULL) f_fail_alloc_and_destroy(msh); - ft_strlcpy(var[FT_VAR_NAME], arg, len); + 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); var[FT_VAR_NULL] = NULL; @@ -46,5 +47,6 @@ void char **var; var = b_get_var(arg, msh); + ft_printf("[%s] - [%s]\n", var[FT_VAR_NAME], var[FT_VAR_VAL]); ft_delwords(var); } |