This commit is contained in:
Manzovince
2019-04-14 14:40:07 +02:00
parent bcfc8c9547
commit ea6595fbd6
4 changed files with 11 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */ /* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */ /* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 12:34:30 by vmanzoni ### ########.fr */ /* Updated: 2019/04/14 14:31:26 by vmanzoni ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -33,7 +33,7 @@ void print_test(char *test);
*/ */
char *read_file(char *file); char *read_file(char *file);
void ft_display_error(char *s, int fd); void print_error(char *s, int fd);
int ft_file_errors(char *file); int ft_file_errors(char *file);
#endif #endif

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */ /* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 14:25:44 by vmanzoni ### ########.fr */ /* Updated: 2019/04/14 14:39:12 by vmanzoni ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -16,9 +16,9 @@
** Function that display error message *s on fd ** Function that display error message *s on fd
*/ */
void ft_display_error(char *s, int fd) void print_error(char *s)
{ {
write(fd, s, strlen(s)); write(2, s, strlen(s));
} }
/* /*

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */ /* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */ /* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 14:27:31 by vmanzoni ### ########.fr */ /* Updated: 2019/04/14 14:39:28 by vmanzoni ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -19,9 +19,9 @@ int main(int argc, char **argv)
if (argc == 2) if (argc == 2)
{ {
if (!(input = read_file(argv[1]))) if (!(input = read_file(argv[1])))
ft_display_error("Error: Could not read file.\n", 2); print_error("Error: Could not read file.\n");
if (ft_file_errors(input)) else if (ft_file_errors(input))
ft_display_error("Error: Invalid file.\n", 2); print_error("Error: Invalid file.\n");
/* /*
Check if every tetrimino is valid Check if every tetrimino is valid
Transform input to tetriminos Transform input to tetriminos
@@ -32,6 +32,6 @@ int main(int argc, char **argv)
print_test(input); print_test(input);
} }
else else
ft_display_error("Error: Please submit a file.\n", 2); print_error("Error: Please submit a file.\n");
return (0); return (0);
} }

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */ /* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/01 13:35:48 by vmanzoni #+# #+# */ /* Created: 2019/03/01 13:35:48 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 14:27:47 by vmanzoni ### ########.fr */ /* Updated: 2019/04/14 14:32:02 by vmanzoni ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -22,5 +22,4 @@ void ft_print_fillit()
void print_test(char *test) void print_test(char *test)
{ {
write(1, test, strlen(test)); write(1, test, strlen(test));
write(1, "\n", 1);
} }