diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-01 19:45:03 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-01 19:45:03 +0200 |
commit | 33b24656b7f0637d74531231f3d1b02bcc76dfc7 (patch) | |
tree | c9697e5ac234d33bd70b8b12726a7ac31a1ee1bd /src/p_args.c | |
parent | Fine (diff) | |
download | 42-minishell-33b24656b7f0637d74531231f3d1b02bcc76dfc7.tar.gz 42-minishell-33b24656b7f0637d74531231f3d1b02bcc76dfc7.tar.bz2 42-minishell-33b24656b7f0637d74531231f3d1b02bcc76dfc7.tar.xz 42-minishell-33b24656b7f0637d74531231f3d1b02bcc76dfc7.tar.zst 42-minishell-33b24656b7f0637d74531231f3d1b02bcc76dfc7.zip |
Shit in progress
Diffstat (limited to 'src/p_args.c')
-rw-r--r-- | src/p_args.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/p_args.c b/src/p_args.c index d42dabe..f14b467 100644 --- a/src/p_args.c +++ b/src/p_args.c @@ -65,13 +65,12 @@ static uint16_t return (argc); while (*ptr != C_NULL && ft_iswhitespace(*ptr) == TRUE) ptr++; - if (*ptr != C_SQUOTE && *ptr != C_DQUOTE) + if (*ptr != C_SQUOTE && *ptr != C_DQUOTE && *ptr != C_NULL) { while (*ptr != C_NULL && ft_iswhitespace(*ptr) == FALSE) { ptr++; - if ((*ptr == C_SQUOTE || *ptr == C_DQUOTE) && - *(ptr - 1) != C_BACKSLASH) + if ((*ptr == C_SQUOTE || *ptr == C_DQUOTE) && *(ptr - 1) != '\\') { ptr++; return (p_count_args(ptr, argc)); @@ -81,9 +80,11 @@ static uint16_t else if (*ptr == C_SQUOTE || *ptr == C_DQUOTE) { ptr = p_skip_delim(ptr, *ptr); - if (ft_isspace(*ptr) == FALSE) + if (ft_iswhitespace(*ptr) == FALSE) return (p_count_args(ptr, argc)); } + else if (*ptr == C_NULL) + return (argc); return (p_count_args(ptr, argc + 1)); } |