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,12 +6,41 @@
|
|||
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/10 09:51:34 by jguelen #+# #+# */
|
||||
/* Updated: 2025/03/19 13:43:24 by jguelen ### ########.fr */
|
||||
/* Updated: 2025/03/20 14:43:17 by jguelen ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "wordlist.h"
|
||||
#include "../worddesc/worddesc.h"
|
||||
#include <stdlib.h>
|
||||
#include "../../../libft/libft.h"
|
||||
|
||||
/*
|
||||
** Creates a new wordlist composed of only one element. Its next field is NULL
|
||||
** and its word field is a copy of the worddesc passed as a parameter.
|
||||
** Returns NULL in case of error.
|
||||
*/
|
||||
t_wordlist *wordlist_independant_create(t_worddesc *word)
|
||||
{
|
||||
t_wordlist *new;
|
||||
t_worddesc *desc_copy;
|
||||
|
||||
new = ft_calloc(1, sizeof(t_wordlist));
|
||||
if (!new)
|
||||
return (NULL);
|
||||
desc_copy = ft_calloc(1, sizeof(t_worddesc));
|
||||
if (!desc_copy)
|
||||
return (free(new), NULL);
|
||||
desc_copy->word = ft_strdup(word->word);
|
||||
if (!desc_copy->word)
|
||||
return (free(desc_copy), free(new), NULL);
|
||||
desc_copy->flags = word->flags;
|
||||
desc_copy->marker = ft_strdup(word->marker);
|
||||
new->word = desc_copy;
|
||||
if (!desc_copy->marker && word->marker)
|
||||
return (wordlist_destroy(new), NULL);
|
||||
return (new);
|
||||
}
|
||||
|
||||
/*
|
||||
** Returns the number of words present in the wordlist given as parameter.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue