diff options
Diffstat (limited to '')
-rw-r--r-- | src/p_args_escape.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/p_args_escape.c b/src/p_args_escape.c index 182ef2f..2df2e0f 100644 --- a/src/p_args_escape.c +++ b/src/p_args_escape.c @@ -21,9 +21,16 @@ static t_quote_mode { if (mode == Q_NONE) { - (void)ft_memmove(word + (ptr - word), ptr + 1, - (ft_strlen(ptr + 1) + 1) * sizeof(char)); - return (Q_SINGLE); + if (u_is_not_escaped(word, ptr) == TRUE) + { + (void)ft_memmove(word + (ptr - word), ptr + 1, + (ft_strlen(ptr + 1) + 1) * sizeof(char)); + return (Q_SINGLE); + } + else + { + return (Q_NONE); + } } else if (mode == Q_SINGLE) { @@ -39,20 +46,21 @@ static t_quote_mode { if (mode == Q_NONE) { - if (u_is_true_quote(word, ptr) == TRUE) + if (u_is_not_escaped(word, ptr) == TRUE) { (void)ft_memmove(word + (ptr - word), ptr + 1, (ft_strlen(ptr + 1) + 1) * sizeof(char)); + return (Q_DOUBLE); } - return (Q_DOUBLE); - } - else if (mode == Q_DOUBLE) - { - if (u_is_true_quote(word, ptr) == TRUE) + else { - (void)ft_memmove(word + (ptr - word), ptr + 1, - (ft_strlen(ptr + 1) + 1) * sizeof(char)); + return (Q_NONE); } + } + else if (mode == Q_DOUBLE && u_is_not_escaped(word, ptr) == TRUE) + { + (void)ft_memmove(word + (ptr - word), ptr + 1, + (ft_strlen(ptr + 1) + 1) * sizeof(char)); return (Q_NONE); } return (mode); @@ -118,8 +126,8 @@ void { /* TODO: escape \ */ /* TODO: escape $# special vars */ + /* TODO: comments ################ */ /* TODO: escape my life */ - /* TODO: comments */ char **ptr; ptr = words; |