summaryrefslogtreecommitdiffstats
path: root/src/m_init.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-27 17:47:04 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-27 17:47:04 +0200
commit8a1352d62c0dd66ecdd5807e83c16a00fb864635 (patch)
tree41d8a9c612e0373f0beed119ccae88e55b6ba8c2 /src/m_init.c
parentTODO update (diff)
download42-minishell-8a1352d62c0dd66ecdd5807e83c16a00fb864635.tar.gz
42-minishell-8a1352d62c0dd66ecdd5807e83c16a00fb864635.tar.bz2
42-minishell-8a1352d62c0dd66ecdd5807e83c16a00fb864635.tar.xz
42-minishell-8a1352d62c0dd66ecdd5807e83c16a00fb864635.tar.zst
42-minishell-8a1352d62c0dd66ecdd5807e83c16a00fb864635.zip
Histfile is BAV
Diffstat (limited to '')
-rw-r--r--src/m_init.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/m_init.c b/src/m_init.c
index c145063..8b8a994 100644
--- a/src/m_init.c
+++ b/src/m_init.c
@@ -10,17 +10,27 @@
/* */
/* ************************************************************************** */
+#include <libft.h>
#include <stdlib.h>
#include "s_struct.h"
+#include "u_vars.h"
#include "u_vars_next.h"
void
m_init_custom_vars(t_msh *msh)
{
+ char *home;
+ char fmt[255];
+
u_subst_var_value("$PS1", FT_DEFAULT_PS_ONE, msh);
u_subst_var_value("$PS2", FT_DEFAULT_PS_TWO, msh);
u_subst_var_value("$PS3", FT_DEFAULT_PS_THR, msh);
u_subst_var_value("$PS4", FT_DEFAULT_PS_FOU, msh);
- u_subst_var_value("$HISTFILE", FT_DEFAULT_HISTFILE, msh);
+ if ((home = u_get_var_value("$HOME", msh)) != NULL)
+ {
+ ft_sprintf(fmt, "%s/%s", home, FT_DEFAULT_HISTFILE);
+ u_subst_var_value("$HISTFILE", fmt, msh);
+ ft_memdel((void*)&home);
+ }
}