mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
Expansion: fixed the algo for star expansion.
This commit is contained in:
parent
41c9548934
commit
00f27ae05c
3 changed files with 14 additions and 59 deletions
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* wildcard_exp.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/20 15:01/38 by khais #+# #+# */
|
||||
/* Updated: 2025/03/20 15:01:38 by khais ### ########.fr */
|
||||
/* Created: 2025/03/20 15:01:38 by jguelen #+# #+# */
|
||||
/* Updated: 2025/03/20 16:53:31 by jguelen ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -96,7 +96,6 @@ static t_wordlist *expand_star_core(t_worddesc *file_pattern)
|
|||
new = readdir(current_dir);
|
||||
while (new)
|
||||
{
|
||||
ft_printf("[dbg] read dir entry: %s\n", new->d_name);
|
||||
if (fits_pattern(new->d_name, file_pattern))
|
||||
{
|
||||
if (add_file_to_list(&file_wordlist, new->d_name) == NULL)
|
||||
|
|
@ -128,8 +127,8 @@ char fits_pattern(char *str, t_worddesc *pattern)
|
|||
size_t i;
|
||||
char ret;
|
||||
|
||||
if (ft_strcmp(".", str) == 0)
|
||||
ft_printf("[dbg] currently matching .\n");
|
||||
if (str && str[0] == '.' && pattern->word[0] != '.')
|
||||
return (0);
|
||||
pattern_len = ft_strlen(pattern->word);
|
||||
str_len = ft_strlen(str);
|
||||
pattern_check = ft_calloc(str_len + 1, sizeof(char *));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue