From 598c360d22fa9b3c863f74bb6280472fd805fa0d Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 17 Aug 2020 18:12:18 +0200 Subject: Fixed unset not working --- src/p_lcom_next.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/p_lcom_next.c') diff --git a/src/p_lcom_next.c b/src/p_lcom_next.c index 3f18ec1..b04d393 100644 --- a/src/p_lcom_next.c +++ b/src/p_lcom_next.c @@ -101,6 +101,28 @@ char return (words); } +char + **p_subst_home(char *words[], + t_msh *msh) +{ + char *path; + char **ptr; + + if ((path = u_get_var_value("$HOME", msh)) == NULL) + return (words); + ptr = words; + while (*ptr != NULL) + { + if (*ptr[0] == '~') + { + *ptr = ft_strsubst(*ptr, "~", path); + } + ptr++; + } + ft_memdel((void*)&path); + return (words); +} + static void p_register_word(char word[], t_msh *msh) -- cgit v1.2.3