summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-01 19:45:03 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-01 19:45:03 +0200
commit33b24656b7f0637d74531231f3d1b02bcc76dfc7 (patch)
treec9697e5ac234d33bd70b8b12726a7ac31a1ee1bd /src
parentFine (diff)
download42-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')
-rw-r--r--src/p_args.c9
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));
}