From 158d5e66c1ab03c79a489f1b7e4e3b6518ec0550 Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Tue, 16 Jul 2024 14:24:51 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20if=20on?= =?UTF-8?q?ly=20space=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/error_msg.h | 3 ++- src/exec/heredoc.c | 3 ++- src/main.c | 4 +++- src/parsing/check_error/check_pipe.c | 12 +++++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/error_msg.h b/include/error_msg.h index 6c3ab51..edf8302 100644 --- a/include/error_msg.h +++ b/include/error_msg.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/20 20:25:06 by adjoly #+# #+# */ -/* Updated: 2024/07/15 18:05:05 by adjoly ### ########.fr */ +/* Updated: 2024/07/16 14:20:19 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,5 +29,6 @@ char *get_program_name(char *argv_one); bool send_error_parsing(char *msg); +bool check_space(char *rl); #endif diff --git a/src/exec/heredoc.c b/src/exec/heredoc.c index 1903cc5..4f2d91a 100644 --- a/src/exec/heredoc.c +++ b/src/exec/heredoc.c @@ -6,7 +6,7 @@ /* By: mmoussou +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/30 12:52:22 by adjoly #+# #+# */ -/* Updated: 2024/07/03 16:17:02 by adjoly ### ########.fr */ +/* Updated: 2024/07/16 14:24:14 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -42,3 +42,13 @@ bool check_pipe(char *readline) } return (false); } + +bool check_space(char *rl) +{ + while (*rl && *rl == ' ') + rl++; + if (!*rl) + return (send_error_parsing(ERROR_NO_FILE)); + else + return (false); +}