summaryrefslogtreecommitdiffstats
path: root/src/p_args.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/p_args.c')
-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));
}