diff options
Diffstat (limited to 'src/parse/parse.c')
| -rwxr-xr-x | src/parse/parse.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/src/parse/parse.c b/src/parse/parse.c index 87478ac..b9cc514 100755 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -30,6 +30,8 @@ t_ret *parse(t_ftlst *input) if (parse_cmd_str_true_false(tag)) { ret->ast = parse_cmd(ret->ast, ret->rest); + if (ret->rest != NULL) + ret->rest = ret->rest->next; } else if (parse_redir_true_false(tag)) { @@ -37,35 +39,25 @@ t_ret *parse(t_ftlst *input) ret->rest = ret->rest->next; if (ret->rest != NULL) ret->ast = parse_redir(ret->ast, ret->rest); - /* printf("%s\n","ici" ); */ - ret->rest = ret->rest->next; - if (ret->rest != NULL) - { - tag = ((t_token *)ret->rest->data)->tag; - if(tag & TAG_IS_STR & TAG_STICK) - ret->ast = parse_redir(ret->ast, ret->rest); - } + tag = ((t_token *)ret->rest->data)->tag; + //while(tag & TAG_IS_STR && tag & TAG_STICK) } - if (ret->rest != NULL) - ret->rest = ret->rest->next; } - - /* 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) */ - /* { */ - /* if (i == 0) */ - /* { */ - /* printf("redir"); */ - /* i++; */ - /* } */ - /* 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); */ + 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) + { + if (i == 0) + { + i++; + } + 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; } |
