/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* m_mshrc.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 #ifdef __linux__ # include #else # include #endif #include "d_define.h" #include "s_struct.h" #include "m_loop.h" #include "u_vars.h" unsigned char m_source_mshrc(t_msh *msh) { char file[PATH_MAX]; char home[PATH_MAX]; int fd; unsigned char ret; file[0] = C_NUL; u_get_var_value(home, "$HOME", PATH_MAX, msh); ft_sprintf(file, "%s/%s", home, M_MINISHELLRC); if ((fd = open(file, O_RDONLY)) < 0) return (0); msh->fd = fd; ret = m_loop(fd, msh); return (ret); }