mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
Expansion: fix but still a problem matching '.'
Problem in the coherence of behaviour regarding ownership with star expansion fixed.
This commit is contained in:
parent
da06c0d4e0
commit
b58848e091
4 changed files with 43 additions and 7 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/23 15:02:59 by jguelen #+# #+# */
|
||||
/* Updated: 2025/03/19 16:48:12 by jguelen ### ########.fr */
|
||||
/* Updated: 2025/03/20 14:17:37 by jguelen ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,8 +15,10 @@
|
|||
#include "replace_substr.h"
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* NOTE: The use of errno and the setting of it was OKed by Alexandru in this */
|
||||
/* context. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
/*
|
||||
** Returns a directory stream corresponding to the current directory.
|
||||
|
|
@ -76,6 +78,9 @@ static t_wordlist *add_file_to_list(t_wordlist **list, char *filename)
|
|||
** that matches pattern->word if any file matches in the current directory.
|
||||
** Otherwise return file_pattern itself if nothing matches the perceived
|
||||
** pattern. This list should be alphabetically sorted.
|
||||
** Can return NULL only in case of error.
|
||||
** NOTE: this function never becomes the owner of file_pattern to maintain
|
||||
** coherency of use.
|
||||
*/
|
||||
static t_wordlist *expand_star_core(t_worddesc *file_pattern)
|
||||
{
|
||||
|
|
@ -102,7 +107,7 @@ static t_wordlist *expand_star_core(t_worddesc *file_pattern)
|
|||
if (errno)
|
||||
return (wordlist_destroy(file_wordlist), NULL);
|
||||
if (!file_wordlist)
|
||||
wordlist_push(file_wordlist, file_pattern);
|
||||
file_wordlist = wordlist_independant_create(file_pattern);
|
||||
return (wordlist_quicksort_full(file_wordlist));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue