summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-03 19:24:54 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-03 19:24:54 +0200
commitbe81297dfc28503f7c1014aad4efcf52bd13aad1 (patch)
tree83fa07a0afac9752473dd2e76c40df46c02efe59 /src
parentIn progress (diff)
download42-minishell-be81297dfc28503f7c1014aad4efcf52bd13aad1.tar.gz
42-minishell-be81297dfc28503f7c1014aad4efcf52bd13aad1.tar.bz2
42-minishell-be81297dfc28503f7c1014aad4efcf52bd13aad1.tar.xz
42-minishell-be81297dfc28503f7c1014aad4efcf52bd13aad1.tar.zst
42-minishell-be81297dfc28503f7c1014aad4efcf52bd13aad1.zip
am good
Diffstat (limited to 'src')
-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);
}