feat: adding the message to correct this error

This commit is contained in:
Raphael 2024-10-31 10:39:11 +01:00
parent cb0fac1273
commit 673048186f
2 changed files with 5 additions and 4 deletions

View file

@ -6,13 +6,14 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/30 16:43:20 by rparodi #+# #+# */ /* Created: 2024/10/30 16:43:20 by rparodi #+# #+# */
/* Updated: 2024/10/30 16:46:28 by rparodi ### ########.fr */ /* Updated: 2024/10/31 10:38:21 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef MESSAGE_ERROR_H #ifndef MESSAGE_ERROR_H
# define MESSAGE_ERROR_H # define MESSAGE_ERROR_H
# define ERR_ARGS_COUNT "Error:\nYou have to give only the map on arguments !" # define ERR_ARGS_COUNT "Error:\nYou have to give only the map on arguments !\n"
# define INV_NAME_MAP "Error:\nThe name of the map have to finish by `.cub` !\n"
#endif #endif

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/30 16:41:32 by rparodi #+# #+# */ /* Created: 2024/10/30 16:41:32 by rparodi #+# #+# */
/* Updated: 2024/10/30 17:26:17 by rparodi ### ########.fr */ /* Updated: 2024/10/31 10:37:56 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -27,6 +27,6 @@ bool ft_parse_args(int argc, char *argv[])
return (write(2, ERR_ARGS_COUNT, strlen(ERR_ARGS_COUNT)), false); return (write(2, ERR_ARGS_COUNT, strlen(ERR_ARGS_COUNT)), false);
if (strlen(argv[1]) < 4 || \ if (strlen(argv[1]) < 4 || \
strcmp((argv[1] + (strlen(argv[1]) - 4)), ".cub") != 0) strcmp((argv[1] + (strlen(argv[1]) - 4)), ".cub") != 0)
return (write(2, "PB\n", 3), false); return (write(2, INV_NAME_MAP, strlen(INV_NAME_MAP)), false);
return (true); return (true);
} }