summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/p_args.c6
-rw-r--r--src/p_args_next.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/p_args.c b/src/p_args.c
index a0da592..72182fd 100644
--- a/src/p_args.c
+++ b/src/p_args.c
@@ -84,11 +84,15 @@ static uint16_t
uint16_t
p_count_args(const char *head, char *ptr, uint16_t argc, size_t start[])
{
+ static uint16_t preset = 512;
+
if (*ptr == C_NULL)
return (argc);
while (*ptr != C_NULL && ft_iswhitespace(*ptr) == TRUE)
ptr++;
- start[argc] = ptr - head;
+ if (preset != argc)
+ start[argc] = ptr - head;
+ preset = argc;
if (*ptr != C_SQUOTE && *ptr != C_DQUOTE && *ptr != C_NULL)
{
p_skip_clean_arg(head, &ptr, argc, start);
diff --git a/src/p_args_next.c b/src/p_args_next.c
index 4d7f979..36f6bf1 100644
--- a/src/p_args_next.c
+++ b/src/p_args_next.c
@@ -56,7 +56,8 @@ static size_t
}
else if (word[end] == C_SQUOTE || word[end] == C_DQUOTE)
{
- end = p_skip_delim_size(word, word[end], end);
+ while (word[end] != C_NULL && ft_iswhitespace(word[end]) == FALSE)
+ end = p_skip_delim_size(word, word[end], end);
}
return (end);
}