update: should have fixed everything

This commit is contained in:
maix0 2024-10-24 23:07:36 +02:00
parent 18e6353329
commit 7d3e0a6a49
2 changed files with 8 additions and 10 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */ /* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/26 13:07:12 by rparodi #+# #+# */ /* Created: 2024/07/26 13:07:12 by rparodi #+# #+# */
/* Updated: 2024/10/24 22:30:02 by maiboyer ### ########.fr */ /* Updated: 2024/10/24 23:04:06 by maiboyer ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,8 +15,8 @@
void ast_print_node_file_redirection_heredoc(t_ast_node self) void ast_print_node_file_redirection_heredoc(t_ast_node self)
{ {
if (self == NULL || self->kind != AST_HEREDOC_REDIRECTION) if (self == NULL || self->kind != AST_HEREDOC_REDIRECTION)
return; return ;
printf("<<%s", self->data.heredoc_redirection.delimiter); printf("<<%s ", self->data.heredoc_redirection.delimiter);
} }
//{ //{
// if (self->data.file_redirection.op == AST_REDIR_HEREDOC) // if (self->data.file_redirection.op == AST_REDIR_HEREDOC)

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */ /* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/14 12:26:51 by maiboyer #+# #+# */ /* Created: 2024/09/14 12:26:51 by maiboyer #+# #+# */
/* Updated: 2024/10/24 22:48:26 by maiboyer ### ########.fr */ /* Updated: 2024/10/24 23:05:59 by maiboyer ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -21,12 +21,12 @@ t_error _word_handle_star(t_ast_word *word, t_state *state, t_vec_str *out);
t_error list_files_in_current_directory(t_vec_str *out); t_error list_files_in_current_directory(t_vec_str *out);
t_error _word_into_str_inner(struct s_word_str_args args); t_error _word_into_str_inner(struct s_word_str_args args);
t_error _word_split_loop_expand(\ t_error _word_split_loop_expand(\
t_expandable_str val, t_vec_str *append, t_string *tmp) t_expandable_str val, t_vec_str *append, t_string *tmp)
{ {
t_vec_str split; t_vec_str split;
t_str stmp; t_str stmp;
if (val.do_expand) if (val.do_expand)
{ {
if (val.value == NULL) if (val.value == NULL)
@ -36,7 +36,7 @@ t_error _word_split_loop_expand(\
if (split.len != 0) if (split.len != 0)
{ {
vec_str_push(append, tmp->buf); vec_str_push(append, tmp->buf);
*tmp = string_new(16); *tmp = string_new(16);
} }
while (!vec_str_pop_front(&split, &stmp)) while (!vec_str_pop_front(&split, &stmp))
vec_str_push(append, stmp); vec_str_push(append, stmp);
@ -47,11 +47,9 @@ t_error _word_split_loop_expand(\
return (NO_ERROR); return (NO_ERROR);
} }
t_error _word_split_loop(\ t_error _word_split_loop(\
bool do_split, t_expandable_str val, t_vec_str *append, t_string *tmp) bool do_split, t_expandable_str val, t_vec_str *append, t_string *tmp)
{ {
if (do_split) if (do_split)
return (_word_split_loop_expand(val, append, tmp)); return (_word_split_loop_expand(val, append, tmp));
else else