diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-05-01 14:40:02 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-05-01 14:40:02 +0200 |
commit | aae7ad207625996732f133188fc7a403855ce86d (patch) | |
tree | 86c3745fe3a224b0de82216ed314f022a4a64db5 /src/ft_p_lcom_next.c | |
parent | Merge branch 'vars' (diff) | |
download | 42-minishell-aae7ad207625996732f133188fc7a403855ce86d.tar.gz 42-minishell-aae7ad207625996732f133188fc7a403855ce86d.tar.bz2 42-minishell-aae7ad207625996732f133188fc7a403855ce86d.tar.xz 42-minishell-aae7ad207625996732f133188fc7a403855ce86d.tar.zst 42-minishell-aae7ad207625996732f133188fc7a403855ce86d.zip |
Vars not ok
Diffstat (limited to '')
-rw-r--r-- | src/ft_p_lcom_next.c | 13 |
1 files changed, 9 insertions, 4 deletions
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; } |