From 347f965b635a992b35991f6e9d2a58523e8b709a Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 22 Aug 2024 17:05:41 +0200 Subject: [PATCH] Fix issues with patterns of form /*/ When introducing the handling of multiple slashed one after another (eg. "///*") the handling of "/*/" patterns stopped working because the asterisk could be assumed to be 0 symbols resulting in // which was simplified to / effectively skipping a layer of dirs. --- src/wildcards.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wildcards.c b/src/wildcards.c index f653db6..a7ad6f3 100644 --- a/src/wildcards.c +++ b/src/wildcards.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/08 10:50:26 by ljiriste #+# #+# */ -/* Updated: 2024/08/22 15:21:35 by ljiriste ### ########.fr */ +/* Updated: 2024/08/22 16:15:32 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,9 +37,12 @@ int branch_at_star(t_vec *expanded, t_wildcard_info *info) t_wildcard_info info_dup; info_dup = *info; - ++info->current_expand_char; - if (add_conformant(expanded, info, '\0')) - return (1); + if (!(*(info->current_expand_char + 1) == '/' && info->current_entry_char == info->entry)) + { + ++info->current_expand_char; + if (add_conformant(expanded, info, '\0')) + return (1); + } if (start_size != expanded->size || *info->current_entry_char == '\0') return (0); ++info_dup.current_entry_char; -- 2.30.2