fix: quoted split work now

This commit is contained in:
Camille Chauvet 2023-02-21 23:12:16 +01:00
parent 916f2c3c50
commit 76bc8fbfd8
2 changed files with 3 additions and 3 deletions

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 12:59:34 by cchauvet #+# #+# */ /* Created: 2023/02/21 12:59:34 by cchauvet #+# #+# */
/* Updated: 2023/02/21 12:59:43 by cchauvet ### ########.fr */ /* Updated: 2023/02/21 23:08:10 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -28,12 +28,12 @@ int ft_is_in_quote(const char *str, size_t n)
if (simple_quoted == 0) if (simple_quoted == 0)
double_quoted = !double_quoted; double_quoted = !double_quoted;
} }
if (str[i] == '\'') else if (str[i] == '\'')
{ {
if (double_quoted == 0) if (double_quoted == 0)
simple_quoted = !simple_quoted; simple_quoted = !simple_quoted;
} }
i++; i++;
} }
return (simple_quoted == 1 + (double_quoted == 1) * 2); return (simple_quoted + double_quoted * 2);
} }