static void ft_affelem(t_control *lst, char **mod, t_cursor c, t_cursor wh) { int j; int col; int size; char *str; t_args *tmp; str = ft_strnewset(lst->width, ' '); j = 0; col = 0; size = lst->size; tmp = lst->first; while (size--) { ft_putshell(mod[LISTC]); if (!j) ft_calccurx(&c, &col, lst, wh); tputs(tgoto(mod[CM], 0, c.y + j + 1), 1, ft_outc); if (col == 1) ft_putshell(str); ft_move_cursor(tmp, c.x, c.y + j + 1, mod); j = (j + 1 < (int)wh.y ? j + 1 : 0); ft_put_elem(lst, mod, tmp); tmp = tmp->next; } }
int ft_print_list(t_arg_list *begin, int fd) { t_arg_list *tmp; int *win; if ((win = ft_prepare_print(begin, fd)) == NULL) return (-1); if (ft_initialize_print(win, fd) < 0) return (0); tmp = begin; while (tmp->nb < tmp->next->nb) { ft_position_cursor(win, tmp->nb, fd); ft_put_elem(tmp, fd); ft_reset_cursor(win, tmp->nb, fd); tmp = tmp->next; } ft_position_cursor(win, tmp->nb, fd); ft_put_elem(tmp, fd); ft_reset_cursor(win, tmp->nb, fd); free(win); return (0); }