/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_get_path_nl.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: joelecle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 18:30:18 by joelecle #+# #+# */ /* Updated: 2020/02/28 18:30:19 by joelecle ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include int8_t ft_get_path_nl(char **words, t_cub *clist) { if (!(*words) || !(*(words + 1)) || (*(words + 2))) { ft_sprintf(clist->errmsg, FT_ERR_ARGS); return (-1); } if (ft_check_ext(*(words + 1), ".cub") < 0) { ft_sprintf(clist->errmsg, FT_ERR_NOT_A_CUB); return (-1); } ft_memdel((void*)&clist->mlist.nlevel_path); if (!(clist->mlist.nlevel_path = ft_strdup(*(words + 1)))) { ft_sprintf(clist->errmsg, FT_ERR_ALLOCATE); return (-1); } if (ft_check_not_found(clist->mlist.nlevel_path) < 0) { ft_sprintf(clist->errmsg, FT_ERR_RD_NL_MAP); return (-1); } return (0); }