update: changed stuff a tad bid

This commit is contained in:
Maieul BOYER 2024-10-10 15:16:58 +02:00
parent 5c7c999da0
commit 390c7976b4
No known key found for this signature in database
3 changed files with 17 additions and 11 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/30 14:29:42 by rparodi #+# #+# */
/* Updated: 2024/10/08 15:26:40 by maiboyer ### ########.fr */
/* Updated: 2024/10/09 13:18:53 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/14 17:57:57 by rparodi #+# #+# */
/* Updated: 2024/09/18 22:18:11 by maiboyer ### ########.fr */
/* Updated: 2024/10/09 15:37:28 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -138,8 +138,7 @@ t_error _ast_get_str__command_substitution(\
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
t_error _ast_get_str__expansion(\
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
t_error _ast_get_str__raw(\
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
t_error _ast_get_str__raw(t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
t_error _ast_get_str__raw__double_quote(\
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
t_error _ast_get_str__raw__no_quote(\
@ -176,8 +175,12 @@ t_error _run_get_exit_code(\
t_ast_node self, t_state *state, int *out);
t_error _spawn_cmd_and_run(t_vec_str args, t_redirections redirs, \
t_state *state, t_command_result *out);
t_error _word_into_str(\
t_ast_node self, t_state *state, t_vec_str *append);
t_error _word_into_str(t_ast_node self, t_state *state, t_vec_str *append);
t_error run_command(\
t_ast_command *command, t_state *state, t_cmd_pipe cmd_pipe, \
t_command_result *out);

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/09 12:44:53 by maiboyer #+# #+# */
/* Updated: 2024/10/09 21:55:35 by maiboyer ### ########.fr */
/* Updated: 2024/10/10 15:16:38 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -55,21 +55,24 @@ t_const_str _token_to_string(t_token *arg)
if (arg == NULL || arg->type == TOK_NONE)
return (NULL);
s = string_new(16);
if (arg->string.buf != NULL)
return (str_clone(arg->string.buf));
{
if (arg->type == TOK_EXPENSION)
string_push_char(&s, '$');
string_push(&s, arg->string.buf);
}
else if (arg->subtokens.buffer != NULL)
{
i = 0;
s = string_new(16);
while (i < arg->subtokens.len)
{
tmp = _token_to_string(&arg->subtokens.buffer[i++]);
string_push(&s, tmp);
str_free((t_str)tmp);
}
return (s.buf);
}
return (NULL);
return (s.buf);
}
static t_error _ast_set_redir_arg(t_ast_node node, t_token *arg)