/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/08 10:50:26 by ljiriste #+# #+# */
-/* Updated: 2024/08/22 14:35:25 by ljiriste ### ########.fr */
+/* Updated: 2024/08/22 15:21:35 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
int branch_at_star(t_vec *expanded, t_wildcard_info *info)
{
const size_t start_size = expanded->size;
+ t_wildcard_info info_dup;
+ info_dup = *info;
++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->current_expand_char;
- ++info->current_entry_char;
- return (add_conformant(expanded, info, '\0'));
+ ++info_dup.current_entry_char;
+ return (add_conformant(expanded, &info_dup, '\0'));
}
int expand_further(t_vec *expanded, t_wildcard_info info)
++info->current_expand_char;
return (add_conformant(expanded, info, quote));
}
- if ((*info->current_expand_char == '?' && *info->current_entry_char != '\0')
+ if ((*info->current_expand_char == '?' && *info->current_entry_char != '\0' && (*info->current_entry_char != '.' || info->current_entry_char != info->entry) && !quote)
|| (*info->current_expand_char == *info->current_entry_char && (*info->current_expand_char != '*' || quote)))
{
++info->current_expand_char;
++info->current_entry_char;
return (add_conformant(expanded, info, quote));
}
- if (*info->current_expand_char == '*' && (*info->current_entry_char != '.' || info->current_entry_char != info->entry))
+ if (*info->current_expand_char == '*' && (*info->current_entry_char != '.' || info->current_entry_char != info->entry) && !quote)
return (branch_at_star(expanded, info));
return (0);
}