aboutsummaryrefslogtreecommitdiff
path: root/src/eval/cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval/cmd.c')
-rw-r--r--src/eval/cmd.c64
1 files changed, 2 insertions, 62 deletions
diff --git a/src/eval/cmd.c b/src/eval/cmd.c
index b76666c..ccb4cc2 100644
--- a/src/eval/cmd.c
+++ b/src/eval/cmd.c
@@ -6,7 +6,7 @@
/* By: charles <charles@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/14 10:41:31 by charles #+# #+# */
-/* Updated: 2020/08/27 17:19:14 by charles ### ########.fr */
+/* Updated: 2020/08/28 16:54:48 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -92,72 +92,12 @@ int eval_cmd(int fds[2], t_env env, t_path path, t_ast *ast)
{
t_fork_param_cmd param;
char **argv;
- /* char *id; */
- /* t_ftlst *tmp; */
- if (!redir_extract(ast->redirs, env, fds))
- {
- ast->redirs = NULL;
+ if (!redir_extract(&ast->redirs, env, fds))
return (-1);
- }
- ast->redirs = NULL;
if ((param.env_local = env_from_array((char*[]){NULL})) == NULL)
return (-1);
- /* while (ast->cmd_argv != NULL */
- /* && ((t_token*)ast->cmd_argv->data)->tag & TAG_IS_STR */
- /* && utils_start_with_valid_identifier(((t_token*)ast->cmd_argv->data)->content)) */
- /* { */
- /* t_ftlst *start; */
- /* */
- /* id = ((t_token*)ast->cmd_argv->data)->content; */
- /* *ft_strchr(id, '=') = '\0'; */
- /* ((t_token*)ast->cmd_argv->data)->content = ft_strchr(id, '\0') + 1; */
- /* if (*((t_token*)ast->cmd_argv->data)->content == '\0') */
- /* ft_lstpop_front(&ast->cmd_argv, NULL); */
- /* else */
- /* { */
- /* t_ftlst *curr = ast->cmd_argv; */
- /* t_ftlst *prev = curr; */
- /* */
- /* while (curr != NULL */
- /* && ((t_token*)curr->data)->tag & TAG_STICK && ((t_token*)curr->data)->tag & TAG_IS_STR) */
- /* { */
- /* prev = curr; */
- /* curr = curr->next; */
- /* } */
- /* if (curr != NULL && ((t_token*)curr->data)->tag & TAG_IS_STR) */
- /* { */
- /* prev = curr; */
- /* curr = curr->next; */
- /* } */
- /* */
- /* start = ast->cmd_argv; */
- /* ast->cmd_argv = prev->next; */
- /* prev->next = NULL; */
- /* } */
- /* */
- /* #<{(| ft_lstiter(start, token_debug); |)}># */
- /* #<{(| puts(""); |)}># */
- /* #<{(| ft_lstiter(ast->cmd_argv, token_debug); |)}># */
- /* */
- /* char **strs = preprocess(&start, env); */
- /* */
- /* if (env_export(param.env_local, id, strs[0]) == NULL) */
- /* return (-1); */
- /* } */
- /* if (ast->cmd_argv == NULL) // FIXME special env not passed to child processes */
- /* { */
- /* ft_vecpop(param.env_local, NULL); */
- /* if (ft_vecswallow_at(env, env->size - 1, param.env_local) == NULL) */
- /* { */
- /* ft_vecdestroy(param.env_local, free); */
- /* return (-1); */
- /* } */
- /* g_last_status_code = 0; */
- /* return (0); */
- /* } */
-
if ((argv = preprocess(&ast->cmd_argv, env)) == NULL)
{
ast->cmd_argv = NULL;