diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c605b66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +objs/ diff --git a/srcs/handle_errors.c b/srcs/handle_errors.c index 5553a00..a149b54 100644 --- a/srcs/handle_errors.c +++ b/srcs/handle_errors.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ -/* Updated: 2019/04/14 17:46:32 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/14 17:53:24 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,16 +41,11 @@ int check_file_errors(char *file) return (1); if (file[i] == '\n') line_nbr++; + if (file[i] == '\n' && file[i+1] == '\n') + return (1); i++; } if (line_nbr < 4 || line_nbr > 129) return (1); return (0); } - -/* -int ft_tetri_errors() -{ - -} -*/ diff --git a/srcs/read_file.c b/srcs/read_file.c index 954e52c..6ed8b27 100644 --- a/srcs/read_file.c +++ b/srcs/read_file.c @@ -6,12 +6,16 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */ -/* Updated: 2019/04/14 17:44:18 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/14 18:03:20 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ #include "../includes/fillit.h" +/* +** Function that read and return a ptr to file +*/ + char *read_file(char *file) { char buf[BUFF_SIZE]; @@ -35,3 +39,26 @@ char *read_file(char *file) close(fd); return (result); } + +/* +** Function that parse a file and return each tetrimino +*/ + +int parse_input(char *input) +{ + int i; + int j; + int nl; + + i = 0; + nl = 0; + while (input[i]) + { + j = 0; + while (j != 4) + { + square[j][] = + j++; + } + } +}