From aae7ad207625996732f133188fc7a403855ce86d Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 1 May 2020 14:40:02 +0200 Subject: Vars not ok --- src/ft_p_lcom_next.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/ft_p_lcom_next.c') diff --git a/src/ft_p_lcom_next.c b/src/ft_p_lcom_next.c index 07fadbe..8313b08 100644 --- a/src/ft_p_lcom_next.c +++ b/src/ft_p_lcom_next.c @@ -29,7 +29,8 @@ static int8_t varval = NULL; s_varname = NULL; varlen = i + 1; - while ((*p_words)[varlen] != '\0' && (*p_words)[varlen] != '$') + while ((*p_words)[varlen] != '\0' && + !ft_ischarset("$=/#@%^*+{}[],.?-", (*p_words)[varlen])) varlen += 1; if (!(s_varname = ft_substr(*p_words, (uint32_t)i, varlen - i))) return (-1); @@ -48,12 +49,16 @@ char int64_t i; p_words = words; + i = 0; while (*p_words) { - while ((i = ft_strlchr(*p_words, '$')) != -1) + while ((i = ft_strlchr((*p_words), '$')) != -1) { - if (ft_subst_those_vars(i, p_words, msh) != 0) - return (NULL); + if (*(*p_words) + i - 1 != '\\') + { + if (ft_subst_those_vars(i, p_words, msh) != 0) + return (NULL); + } } p_words += 1; } -- cgit v1.2.3