示例#1
0
文件: ft_ls.c 项目: mywaystar/ft_ls
int		main(int ac, char **av)
{
	t_ls	ls;

	ft_ls_init_env(&ls);
	ft_ls_init_options(&ls);
	ft_ls_parse_options(&ls, ac, av);
	ft_ls_parse_files(&ls, ac, av);
	ls.follow = 0;
	ft_lstsort(&(ls.errors), &cmp_asc, &get_name);
	ft_ls_sort(&ls, &ls.non_folders);
	ft_ls_sort(&ls, &ls.folders);
	ft_ls_process_files(ls.errors, 0);
	if (ls.non_folders && ls.options.is_all_files)
		get_max_values(ls.non_folders);
	ft_ls_process_files(ls.non_folders, 0);
	ft_ls_process_files(ls.folders, 1);
	return (0);
}
示例#2
0
int				ft_handle_output(t_core *core)
{
	if (OUTPUT)
	{
		OUTPUT = ft_ls_sort(core);
		(ft_strchr(OPT, 'l')) ? ft_long_display(core) : ft_ls_display(core);
		OUTPUT = ft_del_files(core);
	}
	if (OUTPUT && ft_strchr(OPT, 'R'))
	{
		if (PENDING)
			PENDING = ft_lstjoin(&PENDING, OUTPUT);
		else
			PENDING = ft_lstcpy_and_del(OUTPUT);
		OUTPUT = NULL;
	}
	return (0);
}