corrections + ft_file_errors added (not tested)

This commit is contained in:
Manzovince
2019-04-14 12:53:31 +02:00
parent 7c28480555
commit fde6674fd5
4 changed files with 48 additions and 20 deletions

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 12:13:42 by vmanzoni ### ########.fr */
/* Updated: 2019/04/14 12:44:14 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,22 +17,28 @@ int main(int argc, char **argv)
char *input;
short i;
if (argc == 2)
if (argc != 2)
{
if (!(input = read_file(argv[1])))
ft_display_error("Error: Could not read file.\n", 2);
// else if (/*Elements in file not valid*/)
// ft_display_error("Error: Invalid file.\n", 2);
/*
Transform input to tetriminos
Check if every tetrimino is valid
Backtracking for smallest square
Transform tetriminos with letters
Print result
*/
print_test(input);
}
else
ft_display_error("Error: Please submit a file.\n", 2);
return 0;
return (0);
}
else if (!(input = read_file(argv[1])))
{
ft_display_error("Error: Could not read file.\n", 2);
return (0);
}
else if (ft_file_errors(input))
{
ft_display_error("Error: Invalid file.\n", 2);
return (0);
}
/*
Check if every tetrimino is valid
Transform input to tetriminos
Backtracking for smallest square
Transform tetriminos with letters
Print result
*/
print_test(input);
return (0);
}