From 673048186faf6c6d2b1b83895067ba1985d76d5e Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 31 Oct 2024 10:39:11 +0100 Subject: [PATCH] feat: adding the message to correct this error --- includes/message_error.h | 5 +++-- parsing/arguments.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/message_error.h b/includes/message_error.h index 9106469..2984478 100644 --- a/includes/message_error.h +++ b/includes/message_error.h @@ -6,13 +6,14 @@ /* 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 # 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 diff --git a/parsing/arguments.c b/parsing/arguments.c index 2342e28..1b7035f 100644 --- a/parsing/arguments.c +++ b/parsing/arguments.c @@ -6,7 +6,7 @@ /* 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); if (strlen(argv[1]) < 4 || \ 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); }