-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
41 lines (38 loc) · 1.35 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
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aallali <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/19 20:15:25 by aallali #+# #+# */
/* Updated: 2018/12/19 20:15:26 by aallali ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
int main(int argc, char const *argv[])
{
char buf[2];
int fd;
int count;
if (argc != 2)
{
ft_putstr("usage: fillit input_file\n");
return (0);
}
fd = open(argv[1], O_RDONLY);
if (fd == -1 || read(fd, buf, 1) == 0)
{
ft_putendl("error");
return (0);
}
if (fd != -1)
close(fd);
fd = open(argv[1], O_RDONLY);
if ((count = read_tetris(fd, 0)) == 0)
return (0);
close(fd);
fd = open(argv[1], O_RDONLY);
backtrack(fd, count);
return (0);
}