From ad540e17ff14dbbb590befa42b0df1485d28c56a Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 1 Aug 2024 09:52:57 +0200 Subject: [PATCH] Fix here file delimiter recognition Because the input line always contains newline character, it has to only be compared to the last but one character. --- src/execution.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/execution.c b/src/execution.c index ce5ea53..e62fee4 100644 --- a/src/execution.c +++ b/src/execution.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/21 08:57:54 by ljiriste #+# #+# */ -/* Updated: 2024/08/01 09:47:44 by ljiriste ### ########.fr */ +/* Updated: 2024/08/01 09:51:23 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -274,7 +274,7 @@ int here_file_to_pipe(int pipe_fd, const char *delimiter, const t_execution_env expand = !ft_strcmp(unquoted_delimiter, delimiter); ft_printf("> "); line = get_next_line(STDIN_FILENO); - while (line && ft_strcmp(line, unquoted_delimiter)) + while (line && ft_strncmp(line, unquoted_delimiter, ft_strlen(line) - 1)) { if (write_line_to_pipe(pipe_fd, line, env, expand)) { -- 2.30.2