From be81297dfc28503f7c1014aad4efcf52bd13aad1 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 3 Sep 2020 19:24:54 +0200 Subject: am good --- src/p_args.c | 6 +++++- src/p_args_next.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3