Exemple #1
0
int			ft_dir_recursive(char *chemin, char *filename)
{
	if (ft_isdir(chemin) && ft_strcmp("..", filename)
			&& ft_strcmp(".", filename))
		return (1);
	return (0);
}
Exemple #2
0
t_lsto	*ft_printlist31(t_lsto *lstmp)
{
	t_lsto		*lst1;
	t_lsto		*lst2;
	t_lsto		*lstbegio;
	t_loption	loption;

	lst1 = NULL;
	lst2 = NULL;
	while (lstmp)
	{
		if (ft_isdir(ft_makepath(((t_rep*)(lstmp->content))->path,
						((t_rep*)(lstmp->content))->name)) == 0)
			lst_addo(&lst1, lstmp);
		else
			lst_addo(&lst2, lstmp);
		lstmp = lstmp->next;
	}
	lst2 = ft_lst_sort(lst2, croissant_time);
	lstbegio = lst2;
	lst1 = lst_addo_down(lst1, lst2);
	lst1 = ft_lst_sort(lst1, croissant_time);
	ft_printlist7_p1(lst1);
	ft_init2(&loption);
	ft_width(lst1, &loption);
	ft_wl(lst1, loption);
	return (lstbegio);
}
Exemple #3
0
t_lsto	*ft_printlist30(t_lsto *lstmp)
{
	t_lsto	*lst1;
	t_lsto	*lst2;
	t_lsto	*lstbegio;

	lst1 = NULL;
	lst2 = NULL;
	while (lstmp)
	{
		if (ft_isdir(ft_makepath(((t_rep*)(lstmp->content))->path,
						((t_rep*)(lstmp->content))->name)) == 0)
			lst_addo(&lst1, lstmp);
		else if (ft_isdir(ft_makepath(((t_rep*)(lstmp->content))->path,
						((t_rep*)(lstmp->content))->name)) == 1)
			lst_addo(&lst2, lstmp);
		lstmp = lstmp->next;
	}
	lst2 = ft_lst_sort(lst2, croissant_time);
	lstbegio = lst2;
	return (lstbegio);
}
Exemple #4
0
void		ft_save_map(int ac, char **av, t_gen *gen)
{
	int		fd;
	char	*line;
	int		i;

	i = 0;
	if (ac != 2)
		ft_error_files(ac);
	if ((fd = open(av[1], O_RDONLY)) < 0 || !ft_isfile(av[1]) || ft_isdir(av[1]))
		ft_error_pass();
	gen->filename = ft_strdup(av[1]);
	ft_check_file(gen);
	gen->map = malloc(sizeof(t_point**) * gen->y);
	gen->y = 0;
	while (get_next_line(fd, &line))
	{
		ft_save_line(line, gen);
		free(line);
		gen->y++;
	}
	close(fd);
}