Cleaning modif + new file for parsing input

This commit is contained in:
Manzovince
2019-04-15 15:11:50 +02:00
parent 1456316e42
commit 15623fa6bb
6 changed files with 68 additions and 44 deletions

View File

@@ -6,14 +6,14 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 23:01:31 by vmanzoni ### ########.fr */
/* Updated: 2019/04/15 14:48:36 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
/*
** Function that read and return a ptr to file
** Function that read and return a ptr to file content
*/
char *read_file(char *file)
@@ -39,35 +39,3 @@ char *read_file(char *file)
close(fd);
return (result);
}
/*
** Function that parse a file and return each tetrimino
*/
int parse_input(char *input)
{
char tetri;
int c;
int i;
int j;
c = 0;
while (input[c])
{
i = 0;
while (i < 4)
{
j = 0;
while (j < 4)
{
tetri[j] = input[c++];
j++;
}
if (check_tetri_errors(tetri))
print_error("Error: Tetrimino not valid.\n");
c++;
i++;
}
c++;
}
}