/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_s_init.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 "ft_d_define.h" #include "ft_m_funptr.h" #include "ft_s_init.h" t_msh *ft_init_msh(char *envp[]) { t_msh *msh; if (!(msh = (t_msh*)malloc(sizeof(t_msh)))) return (NULL); if (!(msh->ps_one = ft_strdup(FT_PS_ONE))) return (NULL); if (!(msh->shname = ft_strdup(FT_DEFAULT_SHNAME))) return (NULL); msh->cwd = NULL; msh->cwd = getcwd(NULL, 0); /* TODO: handle getcwd failed */ msh->envp = envp; msh->ret = 0; ft_init_buptr(msh); msh->curr = NULL; return (msh); }