diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-08 20:26:51 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-08 20:26:51 +0200 |
commit | 74766656e5b605785e0e9622eb7f10d20a5467e3 (patch) | |
tree | d3818db14279a2e9649e314b3af4e819c61228e2 /src/p_args.c | |
parent | Pretty bav (diff) | |
download | 42-minishell-74766656e5b605785e0e9622eb7f10d20a5467e3.tar.gz 42-minishell-74766656e5b605785e0e9622eb7f10d20a5467e3.tar.bz2 42-minishell-74766656e5b605785e0e9622eb7f10d20a5467e3.tar.xz 42-minishell-74766656e5b605785e0e9622eb7f10d20a5467e3.tar.zst 42-minishell-74766656e5b605785e0e9622eb7f10d20a5467e3.zip |
I hate myself and I want to die
Diffstat (limited to 'src/p_args.c')
-rw-r--r-- | src/p_args.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/src/p_args.c b/src/p_args.c index 78cfc06..a4b3d02 100644 --- a/src/p_args.c +++ b/src/p_args.c @@ -18,6 +18,7 @@ #include "p_args.h" #include "p_args_next.h" #include "p_args_escape.h" +#include "u_parse.h" #include "u_utils.h" static void @@ -33,48 +34,6 @@ static void } } -static t_quote_mode - p_meet_dquote(char *head, char *ptr, t_quote_mode mode) -{ - if (mode == Q_NONE) - { - if (u_is_not_escaped(head, ptr) == TRUE) - { - return (Q_DOUBLE); - } - else - { - return (Q_NONE); - } - } - else if (mode == Q_DOUBLE && u_is_not_escaped(head, ptr) == TRUE) - { - return (Q_NONE); - } - return (mode); -} - -static t_quote_mode - p_meet_squote(char *head, char *ptr, t_quote_mode mode) -{ - if (mode == Q_NONE) - { - if (u_is_not_escaped(head, ptr) == TRUE) - { - return (Q_SINGLE); - } - else - { - return (Q_NONE); - } - } - else if (mode == Q_SINGLE) - { - return (Q_NONE); - } - return (mode); -} - static t_bool p_meet_whitespace(char *head, char *ptr, t_quote_mode mode) { @@ -110,9 +69,9 @@ static uint16_t if (*ptr == C_BACKS) p_meet_bs(ptr, mode); if (*ptr == C_DQUOTE) - mode = p_meet_dquote((char*)word, ptr, mode); + mode = u_meet_dquote((char*)word, ptr, mode); else if (*ptr == C_SQUOTE) - mode = p_meet_squote((char*)word, ptr, mode); + mode = u_meet_squote((char*)word, ptr, mode); if (ft_iswhitespace(*ptr) && p_meet_whitespace((char*)word, ptr, mode) == TRUE) { |