parsing ok

This commit is contained in:
hugogogo
2021-07-24 15:26:48 +02:00
parent 0bf59a09b9
commit 04ef5aab68
8 changed files with 68 additions and 94 deletions

View File

@@ -43,32 +43,17 @@ t_fdf *init_fdf(t_fdf *fdf)
int main(int ac, char **av)
{
t_fdf *fdf;
int fd;
if (ac == 1)
{
fdf = malloc(sizeof(t_fdf));
fdf->map = parse_map(fdf, av);
fdf = init_fdf(fdf);
mlx_hook(fdf->win_ptr, 2, 1L << 0, keypress, fdf);
mlx_hook(fdf->win_ptr, 17, 1L << 17, shut_down, fdf);
mlx_loop(fdf->mlx_ptr);
}
if (ac == 2)
{
int fd;
int ret;
char *line;
ret = 1;
line = NULL;
fd = open(av[1], O_RDONLY);
while (ret > 0)
{
ret = ft_gnl(fd, &line);
ft_printf("%s\n", line);
free(line);
}
}
if (ac != 2)
return (0);
fdf = malloc(sizeof(t_fdf));
fd = open(av[1], O_RDONLY);
fdf->map = parse_map(fdf, fd);
fdf = init_fdf(fdf);
mlx_hook(fdf->win_ptr, 2, 1L << 0, keypress, fdf);
mlx_hook(fdf->win_ptr, 17, 1L << 17, shut_down, fdf);
mlx_loop(fdf->mlx_ptr);
return (0);
}