-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
38 lines (35 loc) · 1.28 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: oelazzou <oelazzou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/27 14:59:40 by oelazzou #+# #+# */
/* Updated: 2019/05/23 21:40:26 by oelazzou ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
int main(int ac, char **av)
{
int fd;
int size;
char *line;
t_tetris *tr;
size = 0;
tr = NULL;
if (ac != 2)
{
ft_putendl_fd("usage: ./fillit file", 1);
exit(EXIT_SUCCESS);
}
fd = open(av[1], O_RDONLY);
if (fd < 0)
exit_error();
line = read_file(fd);
check_all(line);
tr = get_all_tetri(line);
size = ft_sqrt(count_tetri(line) * 4);
solve(size, tr);
return (0);
}