summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-18 22:22:14 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-18 22:22:14 +0200
commitdaec8aba1c0e25c0363b4c5aa1e83a987f76f4b4 (patch)
tree6ee213f4fad2f1dac85282c9d1b8a7ce3e2e9a8b
parentCorrect shell prompt (diff)
download42-minishell-daec8aba1c0e25c0363b4c5aa1e83a987f76f4b4.tar.gz
42-minishell-daec8aba1c0e25c0363b4c5aa1e83a987f76f4b4.tar.bz2
42-minishell-daec8aba1c0e25c0363b4c5aa1e83a987f76f4b4.tar.xz
42-minishell-daec8aba1c0e25c0363b4c5aa1e83a987f76f4b4.tar.zst
42-minishell-daec8aba1c0e25c0363b4c5aa1e83a987f76f4b4.zip
On the way to cwd
Diffstat (limited to '')
-rw-r--r--src/ft_s_init.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ft_s_init.c b/src/ft_s_init.c
index 88a3817..f3ebaf6 100644
--- a/src/ft_s_init.c
+++ b/src/ft_s_init.c
@@ -18,6 +18,7 @@
#include "ft_d_define.h"
#include "ft_m_funptr.h"
#include "ft_s_init.h"
+#include "ft_u_vars.h"
static char
**ft_dupenv_del(char **nenvp,
@@ -71,12 +72,11 @@ t_msh
if (!(msh->shname = ft_strdup(argv[0])))
return (NULL);
/* TODO: shname: care about "./", try with symlinks */
- msh->cwd = NULL;
- msh->cwd = getcwd(NULL, 0);
- /* TODO: handle getcwd failed */
msh->envp = NULL;
if (!(msh->envp = ft_dupenv(envp)))
return (NULL);
+ msh->cwd = NULL;
+ msh->cwd = ft_subst_var_value("$PWD", msh);
msh->ret = 0;
ft_init_buptr(msh);
msh->curr = NULL;