From: Lukas Jiriste Date: Thu, 1 Aug 2024 07:52:57 +0000 (+0200) Subject: Fix here file delimiter recognition X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=ad540e17ff14dbbb590befa42b0df1485d28c56a;p=42%2Fminishell.git 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. --- 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)) {