Exemplo n.º 1
0
void			ls_list_dir_cont(char *name, t_lst *dcontent, t_lst *subdirs,
							t_lsargs *args)
{
	t_lst	*el;
	t_uint	sub_count;

	if ((name[0] != '.' || HCK2 || args->ndirs) || HCK)
	{
		if (args->flags & FLAG_l && dcontent)
			ls_l_tblock(dcontent);
		ls_display_cont(dcontent, args);
	}
	if (args->flags & FLAG_R)
	{
		if (subdirs && ((name[0] != '.' || !ft_strcmp(name, ".")) || HCK))
			ft_putchar('\n');
		if (args->flags & FLAG_r)
			ft_lstrev(&subdirs);
		while ((el = ft_lstpop(&subdirs)) != NULL)
		{
			if (((t_lsentry*)el->data)->name[0] != '.' || HCK)
				HCKLOL;
			sub_count = ls_list_dir((t_lsentry*)el->data, args);
			if ((el->next || (el->next && sub_count)) && FTDODO)
				ft_putchar('\n');
			ft_lstdelone(&el, ls_del_ent);
		}
	}
}
Exemplo n.º 2
0
void	ft_ls_sort(t_ls *ls, t_list **list)
{
	ft_lstsort(list, &cmp_asc, &get_name);
	if (ls->options.is_ordered_by_time)
		ft_lstsort(list, &time_asc, &get_elem);
	if (ls->options.is_reverse)
		ft_lstrev(list);
}
Exemplo n.º 3
0
void			ls_display_cont(t_lst *list, t_lsargs *args)
{
	t_lst		*el;
	t_l_form	form;

	ls_l_form_init(&form);
	if (args->flags & FLAG_l)
		ls_l_count(list, &form, NULL);
	if (args->flags & FLAG_r)
		ft_lstrev(&list);
	while ((el = ft_lstpop(&(list))) != NULL)
	{
		if (((t_lsentry*)el->data)->name[0] == '.' && !(args->flags & FLAG_a))
			continue ;
		if (args->flags & FLAG_l)
			ls_pinfos((t_lsentry*)el->data, &form);
		ls_pname((t_lsentry*)el->data);
		if (S_ISLNK(((t_lsentry*)el->data)->infos.st_mode)
				&& args->flags & FLAG_l)
			ls_l_plink(((t_lsentry*)el->data)->path);
		ft_putchar('\n');
		ft_lstdelone(&el, ls_del_ent);
	}
}