/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* p_subst_home.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include "d_define.h" #include "s_struct.h" #include "u_vars.h" char **p_subst_home(char *words[], t_msh *msh) { char path[PATH_MAX]; char **ptr; u_get_var_value(path, "$HOME", PATH_MAX, msh); if (path[0] == C_NUL) return (words); ptr = words; while (*ptr != NULL) { if (*ptr[0] == '~') { *ptr = ft_strsubst(*ptr, "~", path); } ptr++; } return (words); }