Esempio n. 1
0
t_ls		*ft_sort_inc(t_ls *ls)
{
	t_ls	*tmp;
	int		size;
	t_ls	*elem;
	int		i;

	i = 0;
	tmp = ls;
	size = ft_get_size_ls(tmp);
	while (size)
	{
		while( i < (size - 1))
		{
			if ( ft_strcmp_det((tmp->next)->name, tmp->name) > 0)
			{
				elem = tmp->next;
				tmp->next = tmp;
				tmp = elem;
			}
			tmp = tmp->next;
			i++;
		}
		i = 0;
		tmp = ls;
		size--;
	}
	return (ls);
}
Esempio n. 2
0
void	ft_sort_li(t_list *li)
{
	t_list	*cpy;
	t_list	*elem;
	int		size;
	char	*value;

	size = get_size(li);
	cpy = li;
	while (size)
	{

			printf("pouet\n");
		while (cpy->next)
		{
			if (ft_strcmp_det(cpy->str, cpy->next->str) < 0)
			{
				elem = cpy;
				cpy = cpy->next;
				cpy->next = elem;
			}
			cpy = cpy->next;
			printf("pouet\n");
		}
		cpy = li;
		size--;
	}

	return ;
}
Esempio n. 3
0
void 	ft_sort_dec_time_name(t_ls *ls)
{
	t_ls	*cpy;
	int		size;

	cpy = ls;
	size = ft_get_size_ls(cpy);
	while (size)
	{
		while(cpy->next)
		{
			if ( ft_strcmp_det(cpy->next->name_low, cpy->name_low) < 0)
			{
				if (ft_strcmp_det(cpy->next->modification, cpy->modification) == 0)
					ft_swap_1(cpy->next, cpy);
			}
			cpy = cpy->next;
		}
		cpy = ls;
		size--;
	}
}