#include #include #include static int ft_get_f_color(char **words, t_win *wlist) { char **num; if (!(*words) || ft_strcmp(*words, "F") || !words[1] || words[2]) return (-1); if (!(num = ft_split(words[1], ','))) return (-1); if (!num[0] || !num[1] || !num[2] || num[3]) { ft_free_words(num, NULL); return (-1); } wlist->clist->f_color = ft_atoi(num[0]); wlist->clist->f_color *= 1000; wlist->clist->f_color += ft_atoi(num[1]); wlist->clist->f_color *= 1000; wlist->clist->f_color += ft_atoi(num[2]); ft_free_words(num, NULL); return (0); } int ft_get_colors(int fd, t_win *wlist) { char *line; char **words; if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); return (ft_map_error(8, wlist)); } if (ft_get_f_color(words, wlist) < 0) { ft_free_words(words, line); return (ft_map_error(8, wlist)); } ft_free_words(words, line); /* if (ft_get_c_color(words, wlist) < 0) */ /* return (-1); */ return (0); }