Expansion: Fixed inclusions and Norm checked

Now on to remake tests properly.
This commit is contained in:
Jérôme Guélen 2025-03-19 09:20:51 +01:00
parent bed41f4a6f
commit 0f8b18b32f
No known key found for this signature in database
8 changed files with 33 additions and 64 deletions

View file

@ -6,7 +6,7 @@
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/23 15:02:59 by jguelen #+# #+# */
/* Updated: 2025/03/18 18:44:05 by jguelen ### ########.fr */
/* Updated: 2025/03/19 09:18:53 by jguelen ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,9 +14,6 @@
#include "subst.h"
#include "replace_substr.h"
/*
** TODO Pre-process file_pattern worddesc for a congruent marker string
*/
/******************************************************************************/
/* NOTE: The use of errno and the setting of it was OKed by Alexandru in this */
/* context. */
@ -25,7 +22,7 @@
** Returns a directory stream corresponding to the current directory.
**
*/
DIR *open_current_dir(void)
static DIR *open_current_dir(void)
{
char *cur_dir_path;
size_t size;
@ -51,11 +48,6 @@ DIR *open_current_dir(void)
return (dir);
}
/*
** TODO produce a clean marker string that denotes file_desc as issued from
** a pattern expansion or as quoted for possible spaces characters in the
** filename not to pose any possible issue.
*/
static t_wordlist *add_file_to_list(t_wordlist **list, char *filename)
{
t_worddesc *file_desc;
@ -74,20 +66,6 @@ static t_wordlist *add_file_to_list(t_wordlist **list, char *filename)
return (*list);
}
/*
** TODO Check if return value correct regarding the manual specifically the
** following:
** cf Bash scans each word for the character '*'.
**
** If one of these characters appears, and is not quoted, then the word is
** regarded as a PATTERN, and replaced with an alphabetically sorted list
** of filenames matching the pattern (see: Pattern Matching). If no matching
** filenames are found, the word is left unchanged.
** --> TODO this function should be provided with a properly pre-processed
** file_pattern where file_pattern->matcher denotes the quoted wildcards
** but the quotes themselves unquoted have been removed from word in a manner
** keeping the relationship between word and marker coherent.
*/
/*
** A function designed to present all possible * or ? filename expansions
** for the current directory. (? is not asked by the subject).
@ -164,9 +142,6 @@ char fits_pattern(char *str, t_worddesc *pattern)
}
/*
** TODO
** Pre-processes file_pattern to give it a proper marker chain and remove
** unquoted quotes from the pattern.
** Returns NULL in case of error.
** NOTE: This phase of pre-processing relies partly on processing done before
** it therefore checks more loosely (and quote removal still seems not to be