update: changed stuff a tad bid
This commit is contained in:
parent
5c7c999da0
commit
390c7976b4
3 changed files with 17 additions and 11 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/30 14:29:42 by rparodi #+# #+# */
|
/* 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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/14 17:57:57 by rparodi #+# #+# */
|
/* 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_ast_node elem, t_word_iterator *state, t_vec_estr *out);
|
||||||
t_error _ast_get_str__expansion(\
|
t_error _ast_get_str__expansion(\
|
||||||
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
|
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
|
||||||
t_error _ast_get_str__raw(\
|
t_error _ast_get_str__raw(t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
|
||||||
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
|
|
||||||
t_error _ast_get_str__raw__double_quote(\
|
t_error _ast_get_str__raw__double_quote(\
|
||||||
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
|
t_ast_node elem, t_word_iterator *state, t_vec_estr *out);
|
||||||
t_error _ast_get_str__raw__no_quote(\
|
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_ast_node self, t_state *state, int *out);
|
||||||
t_error _spawn_cmd_and_run(t_vec_str args, t_redirections redirs, \
|
t_error _spawn_cmd_and_run(t_vec_str args, t_redirections redirs, \
|
||||||
t_state *state, t_command_result *out);
|
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_error run_command(\
|
||||||
t_ast_command *command, t_state *state, t_cmd_pipe cmd_pipe, \
|
t_ast_command *command, t_state *state, t_cmd_pipe cmd_pipe, \
|
||||||
t_command_result *out);
|
t_command_result *out);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/09 12:44:53 by maiboyer #+# #+# */
|
/* 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)
|
if (arg == NULL || arg->type == TOK_NONE)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
s = string_new(16);
|
||||||
if (arg->string.buf != NULL)
|
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)
|
else if (arg->subtokens.buffer != NULL)
|
||||||
{
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
s = string_new(16);
|
|
||||||
while (i < arg->subtokens.len)
|
while (i < arg->subtokens.len)
|
||||||
{
|
{
|
||||||
tmp = _token_to_string(&arg->subtokens.buffer[i++]);
|
tmp = _token_to_string(&arg->subtokens.buffer[i++]);
|
||||||
string_push(&s, tmp);
|
string_push(&s, tmp);
|
||||||
str_free((t_str)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)
|
static t_error _ast_set_redir_arg(t_ast_node node, t_token *arg)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue