ofc last minute bug

This commit is contained in:
Quinten Mennen 2025-02-27 19:22:23 +01:00
parent e07d4b4d79
commit 2d9b35d127

View File

@ -6,7 +6,7 @@
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/05 19:03:47 by qmennen #+# #+# */ /* Created: 2025/02/05 19:03:47 by qmennen #+# #+# */
/* Updated: 2025/02/27 19:20:22 by qmennen ### ########.fr */ /* Updated: 2025/02/27 19:22:09 by qmennen ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,17 +15,21 @@
static int match_quotes(t_minishell *msh, t_lexer *lexer) static int match_quotes(t_minishell *msh, t_lexer *lexer)
{ {
int i; int i;
int qts; int d_qts;
int s_qts;
i = lexer->pos; i = lexer->pos;
qts = 0; d_qts = 0;
s_qts = 0;
while (lexer->input[i]) while (lexer->input[i])
{ {
if (lexer->input[i] == '\'' || lexer->input[i] == '"') if (lexer->input[i] == '\'')
qts++; s_qts++;
if (lexer->input[i] == '\'')
d_qts++;
i++; i++;
} }
return ((qts % 2) == 0); return ((s_qts % 2) == 0 && (d_qts % 2) == 0);
} }
static int calculate_word_len(t_minishell *msh, t_lexer *lexer) static int calculate_word_len(t_minishell *msh, t_lexer *lexer)