From 5c0c4bbbfde5def6425f2f12bb778701e5f176c6 Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Tue, 30 Jul 2024 18:32:43 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20pipe=20?= =?UTF-8?q?error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parsing/check_error/check_pipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/parsing/check_error/check_pipe.c b/src/parsing/check_error/check_pipe.c index cc9bfac..3658100 100644 --- a/src/parsing/check_error/check_pipe.c +++ b/src/parsing/check_error/check_pipe.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/30 12:52:22 by adjoly #+# #+# */ -/* Updated: 2024/07/30 16:42:50 by adjoly ### ########.fr */ +/* Updated: 2024/07/30 17:50:40 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,10 +35,11 @@ bool check_pipe(char *readline) { if (*tmp == '|' && is_inquote(readline, tmp - readline) == FALSE) { - while (tmp && *tmp && ft_isspace(*tmp)) + if (*(tmp + 1) == '|') + return (send_error_parsing("No command after pipe")); + while (*tmp && ft_isspace(*tmp)) tmp++; - printf("%s\n", tmp); - if (!tmp && !*tmp) + if ((!tmp && !*tmp) || *tmp == '|') return (send_error_parsing("No command after pipe")); } tmp++;