summaryrefslogtreecommitdiffstats
path: root/src/b_cd.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-17 18:12:18 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-17 18:12:18 +0200
commit598c360d22fa9b3c863f74bb6280472fd805fa0d (patch)
tree0f4da458afd6ee66a9aa203df459e061970de5a1 /src/b_cd.c
parentSet libft/ft_is* to type t_bool (diff)
download42-minishell-598c360d22fa9b3c863f74bb6280472fd805fa0d.tar.gz
42-minishell-598c360d22fa9b3c863f74bb6280472fd805fa0d.tar.bz2
42-minishell-598c360d22fa9b3c863f74bb6280472fd805fa0d.tar.xz
42-minishell-598c360d22fa9b3c863f74bb6280472fd805fa0d.tar.zst
42-minishell-598c360d22fa9b3c863f74bb6280472fd805fa0d.zip
Fixed unset not working
Diffstat (limited to 'src/b_cd.c')
-rw-r--r--src/b_cd.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/b_cd.c b/src/b_cd.c
index 2248a89..d2b1042 100644
--- a/src/b_cd.c
+++ b/src/b_cd.c
@@ -32,14 +32,6 @@ static void
{
f_alloc_and_destroy_msh(msh);
}
- if (ft_strncmp("~/", *path, 2) == 0 || !ft_strncmp("~", *path, 2))
- {
- if (!(*path = ft_strsubst(*path,
- "~", u_get_var_value("$HOME", msh))))
- {
- f_alloc_and_destroy_msh(msh);
- }
- }
}
static void
@@ -142,8 +134,11 @@ uint8_t
}
else if (argc == 0)
{
- if (!(path = u_get_var_value("$HOME", msh)))
- return (1);
+ if ((path = u_get_var_value("$HOME", msh)) == NULL)
+ {
+ ft_dprintf(STDERR_FILENO, "minishell: cd: HOME not set\n");
+ return (2);
+ }
}
else
set_path(&path, args, msh);