示例#1
0
void	ft_sort_params_dir(char **argv, int argc, t_option *op)
{
	if (op->by == 1 && op->rev == 0)
		ft_sort_params(argv, argc);
	if (op->by == 1 && op->rev == 1)
		ft_sort_params_rev(argv, argc);
	if (op->by == 2)
		ft_sort_time(argv, argc, op);
}
示例#2
0
void				ft_get_sort(t_ls *ls, t_file *parent, t_file *file)
{
	while (file != NULL && file->prev != NULL)
		file = file->prev;
	if (ft_strchr(ls->options, 'f') == NULL)
	{
		if (ft_strchr(ls->options, 't') != NULL)
		{
			if (ft_strchr(ls->options, 'u') != NULL)
				file = assign(ls, parent, ft_sort_time_last_access(file));
			else
				file = assign(ls, parent, ft_sort_time(file));
		}
		else
			file = assign(ls, parent, ft_sort_ascii(file));
		if (ft_strchr(ls->options, 'r') != NULL)
			assign(ls, parent, ft_sort_reverse(file));
	}
}
示例#3
0
文件: hub_dir.c 项目: francoios/Ft_LS
void	ft_hub_dir(char *dir, t_bol bol)
{
	char	**files;
	char	*path;
	int		len;

	len = ft_count_files(dir);
	if (len == -1)
		return ;
	files = (char **)malloc(sizeof(char *) * len + 1);
	files = ft_fetch_files(dir, files);
	path = ft_strjoin(dir, "/");
	if (bol.t == 1 && files[0] != NULL)
	{
		files = ft_sort_ascii(files, 0);
		files = ft_sort_time(files, path, bol);
	}
	else if (files[0] != NULL)
		files = ft_sort_ascii(files, bol.r);
	ft_print_dir(files, bol, dir);
	free(path);
}