-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
42 lines (39 loc) · 1.26 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
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akerkeb <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/21 23:14:29 by akerkeb #+# #+# */
/* Updated: 2016/01/21 23:14:31 by akerkeb ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
int main(int ac, char **av)
{
int fi;
char buf[1025];
int r;
if (ac == 2)
{
fi = open(av[1], O_RDONLY);
if (fi > 0)
{
r = read(fi, buf, 1024);
buf[r] = '\0';
if (r < 1 || !ft_check_tetri(buf))
{
ft_putendl("error");
close(fi);
return (0);
}
close(fi);
}
else
ft_putendl("error");
}
else
ft_putendl("error");
return (0);
}