Fixed issue where '*' would be treated as glob

This commit is contained in:
maix0 2024-10-11 22:36:42 +02:00
parent baa9af918f
commit 1e4185a544
5 changed files with 16 additions and 14 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/14 12:26:51 by maiboyer #+# #+# */
/* Updated: 2024/09/18 22:16:54 by maiboyer ### ########.fr */
/* Updated: 2024/10/11 22:33:02 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -63,7 +63,7 @@ t_error _word_into_str(t_ast_node self, t_state *state, t_vec_str *append)
|| self->kind != AST_WORD)
return (ERROR);
if (_word_is_star(&self->data.word))
return (_word_handle_star(&self->data.word, state, append));
return (dprintf(2, "word is star !\n"), _word_handle_star(&self->data.word, state, append));
if (run_word(&self->data.word, state, &res))
return (ERROR);
if (res.kind == AST_WORD_NO_QUOTE)

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/14 12:26:51 by maiboyer #+# #+# */
/* Updated: 2024/10/10 17:44:20 by maiboyer ### ########.fr */
/* Updated: 2024/10/11 22:36:11 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ t_error list_files_in_current_directory(t_vec_str *out);
bool _word_is_star(t_ast_word *word)
{
return (word->kind == AST_WORD_NO_QUOTE && word->inner.len == 1 \
return (BONUS && word->kind == AST_WORD_NO_QUOTE && word->inner.len == 1 \
&& word->inner.buffer[0]->kind == AST_RAW_STRING \
&& str_compare("*", word->inner.buffer[0]->data.raw_string.str));
}