summaryrefslogtreecommitdiffstats
path: root/src/b_cd.c
diff options
context:
space:
mode:
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);