コード例 #1
0
ファイル: list.c プロジェクト: ncoden/ft_select
t_bool			list_print_line(t_select_list *list, int index)
{
	int			count;
	int			found;
	t_lst_item	*item;
	t_lst_col	*col;

	found = FALSE;
	count = 0;
	col = list->cols;
	while (col)
	{
		if (index < col->height
			&& (item = (t_lst_item *)ft_lstget((t_lst *)col->items, index)))
		{
			found = TRUE;
			list_print_item(item, (count + index == list->cursor));
			if (col->next)
				ft_putnchr_fd(' ', col->width - ft_strlen(item->name),
					ft_trmgetout());
		}
		count += col->height;
		col = col->next;
	}
	if (found)
		ft_putchr_trm('\n');
	return (found);
}
コード例 #2
0
ファイル: ft_lstget.c プロジェクト: vmonteco/libft
t_list		*ft_lstget(t_list *lst, size_t n)
{
	if (n == 0 || lst == NULL)
		return (lst);
	return (ft_lstget(lst->next, n - 1));
}