Beispiel #1
0
int	main(int ac, char **av)
{
    t_args		args;
    t_files		*files;
    int			err;

    files = NULL;
    args.i = 0;
    err = 0;
    ft_check_args(ac, av, &args);
    ft_tri_links(&args);
    while (args.i < args.fns)
    {
        if (args.br)
            ft_recursive(args.link[args.i], args, &err);
        else
        {
            files = ft_readdirr(args.link[args.i], args, &err);
            ft_tri(files, args);
            ft_show_files(args.link[args.i], files, args, err);
            ft_free_list(files, args);
        }
        err = 0;
        args.i++;
    }
    ft_free_args(&args);
    return (0);
}
Beispiel #2
0
void		ft_recursive(char *filename, t_args args, int *err)
{
	t_files		*files;
	t_files		*next;
	char		*chemin;
	char		*tmp;

	files = NULL;
	tmp = NULL;
	files = ft_readdirr(filename, args, err);
	ft_tri(files, args);
	ft_show_files(filename, files, args, *err);
	chemin = ft_strjoin(args.link[args.i], "/");
	tmp = ft_strjoin(filename, "/");
	free(chemin);
	next = files;
	args.rec++;
	while (files != NULL)
	{
		chemin = ft_strjoin(tmp, files->name);
		if (ft_dir_recursive(chemin, files->name))
			ft_recursive(chemin, args, err);
		free(chemin);
		files = files->next;
	}
	free(tmp);
	ft_free_list(next, args);
}
Beispiel #3
0
t_tree	*ft_tri_tree(t_list *l)
{
	t_tree *t;

	t = NULL;
	while (l)
	{
		ft_tri(&t, l->name);
		l = l->next;
	}
	return (t);
}