-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
48 lines (44 loc) · 1.5 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
43
44
45
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: itiievsk <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/03/29 12:54:50 by itiievsk #+# #+# */
/* Updated: 2018/04/04 12:47:01 by averemiy ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
static void ft_print_array(char **arr, int m)
{
while (arr != NULL && *arr != NULL && arr[m])
{
ft_putstr(arr[m++]);
ft_putchar('\n');
}
}
int main(int argc, char **argv)
{
int p[8];
char *str;
t_tetr_list *l;
char **arr;
l = NULL;
arr = NULL;
ft_bzero(p, 32);
if (argc != 2)
{
ft_putstr("usage: fillit input_file\n");
exit(1);
}
str = ft_record_str(argv[1], p);
ft_check_tetr(str, p, 0, 0);
ft_create_tetr_list(str, &l, 0, 0);
if (l == NULL)
ft_quit(str, p);
if ((arr = ft_solve(&l, p, 0)) == NULL)
ft_putstr("error\n");
ft_print_array(arr, 0);
ft_clean_all(p, arr, &l, str);
}