aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c16
-rwxr-xr-xsrc/parse/parse.c26
2 files changed, 28 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index 55f50c0..777f1e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -44,8 +44,20 @@ int main(int argc, char **argv, char **envp)
ft_lstiter(lex_out, token_debug);
- t_ret *parser_out = parse(lex_out);
-
+ t_ret *ret = parse(lex_out);
+
+ printf("===========cmd=============\n");
+ while(ret->ast->cmd_argv != NULL)
+ {
+ printf("[%s]\n", ((t_token *)ret->ast->cmd_argv->data)->content);
+ ret->ast->cmd_argv = ret->ast->cmd_argv->next;
+ }
+ printf("=========redir============\n");
+ while(ret->ast->redirs != NULL)
+ {
+ printf("[%s]\n", ((t_token *)ret->ast->redirs->data)->content);
+ ret->ast->redirs = ret->ast->redirs->next;
+ }
/* printf("%p\n", parser_out->ast->cmd_argv); */
/* printf("%p\n", parser_out->ast->redirs); */
diff --git a/src/parse/parse.c b/src/parse/parse.c
index 867325b..36e603a 100755
--- a/src/parse/parse.c
+++ b/src/parse/parse.c
@@ -47,17 +47,19 @@ t_ret *parse(t_ftlst *input)
}
}
}
- while(ret->ast->cmd_argv != NULL)
- {
- printf("[%s]\n", ((t_token *)ret->ast->cmd_argv->data)->content);
- ret->ast->cmd_argv = ret->ast->cmd_argv->next;
- }
- while(ret->ast->redirs != NULL)
- {
- printf("[%s]\n", ((t_token *)ret->ast->redirs->data)->content);
- ret->ast->redirs = ret->ast->redirs->next;
- }
- ast_destroy(ret->ast);
- ft_lstdestroy(&ret->rest, (void (*)(void*))token_destroy);
+ // printf("===========cmd=============\n");
+ // while(ret->ast->cmd_argv != NULL)
+ // {
+ // printf("[%s]\n", ((t_token *)ret->ast->cmd_argv->data)->content);
+ // ret->ast->cmd_argv = ret->ast->cmd_argv->next;
+ // }
+ // printf("=========redir============\n");
+ // while(ret->ast->redirs != NULL)
+ // {
+ // printf("[%s]\n", ((t_token *)ret->ast->redirs->data)->content);
+ // ret->ast->redirs = ret->ast->redirs->next;
+ // }
+ //ast_destroy(ret->ast);
+ //ft_lstdestroy(&ret->rest, (void (*)(void*))token_destroy);
return first;
}