diff options
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | include/ast.h | 8 | ||||
| -rw-r--r-- | include/eval.h | 30 | ||||
| m--------- | minishell_test | 0 | ||||
| -rw-r--r-- | src/debug.c | 61 | ||||
| -rw-r--r-- | src/env.c | 4 | ||||
| -rw-r--r-- | src/eval/cmd.c | 3 | ||||
| -rw-r--r-- | src/eval/op.c | 46 | ||||
| -rw-r--r-- | src/main.c | 288 |
9 files changed, 234 insertions, 222 deletions
@@ -20,18 +20,18 @@ You can then read the man pages in ./doc/man or open ./doc/html/index.html in yo - [ ] Show a prompt when waiting for a new command - [x] Search and launch the right executable (based on the *PATH* variable or by using relative or absolute path) like in bash - [ ] It must implement the builtins like in bash: - - [ ] `echo` with option `-n` + - [x] `echo` with option `-n` - [ ] `cd` without `-` option - [ ] `pwd` without any options - [ ] `export` without any options - [ ] `unset` without any options - [ ] `env` without any options and any arguments - [ ] `exit` without any options -- [ ] `;` in the command should separate commands like in bash -- [ ] `'` and `"` should work like in bash except for multiline commands +- [x] `;` in the command should separate commands like in bash +- [x] `'` and `"` should work like in bash except for multiline commands - [ ] Redirections `<` `>` `>>` should work like in bash except for file descriptor aggregation - [ ] Pipes | should work like in bash -- [ ] Environment variables (`$` followed by characters) should work like in bash +- [x] Environment variables (`$` followed by characters) should work like in bash - [ ] `$?` should work like in bash - [ ] `ctrl-C`, `ctrl-D` and `ctrl-\` should have the same result as in bash @@ -40,11 +40,13 @@ You can then read the man pages in ./doc/man or open ./doc/html/index.html in yo - [ ] Redirection `<<` like in bash - [ ] History and line editing with Termcaps (`man tgetent` for examples) - [ ] Edit the line where the cursor is located. - - [ ] Move the cursor left and right to be able to edit the line at a specific location. Obviously new characters have to be inserted between the existing ones similarly to a classic shell. + - [ ] Move the cursor left and right to be able to edit the line at a specific location. + Obviously new characters have to be inserted between the existing ones similarly to a classic shell. - [ ] Use up and down arrows to navigate through the command history which we will then be able to edit if we feel like it (the line, not the history). - [ ] Cut, copy, and/or paste all or part of a line using the key sequence you prefer. - [ ] Move directly by word towards the left or the right using ctrl+LEFT and ctrl+RIGHT. - [ ] Go directly to the beginning or the end of a line by pressing `home` and `end`. - - [ ] Write AND edit a command over a few lines. In that case, we would love that ctrl+UP and ctrl+DOWN allow to go from one line to another in the command while remaining in the same column or otherwise the most appropriate column. + - [ ] Write AND edit a command over a few lines. In that case, we would love that ctrl+UP and ctrl+DOWN allow + to go from one line to another in the command while remaining in the same column or otherwise the most appropriate column. - [ ] &&, || with parenthesis for priorities, like in bash -- [ ] wilcard * like in bash +- [x] wilcard * like in bash diff --git a/include/ast.h b/include/ast.h index fb1d059..597c444 100644 --- a/include/ast.h +++ b/include/ast.h @@ -6,7 +6,7 @@ /* By: charles <charles@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:38 by charles #+# #+# */ -/* Updated: 2020/06/19 13:15:30 by nahaddac ### ########.fr */ +/* Updated: 2020/06/19 13:29:27 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -48,9 +48,9 @@ typedef struct s_op enum e_ast_tag { - AST_CMD = 1 << 0, - AST_OP = 1 << 1, - AST_OP_PARENT = 1 << 2, + AST_CMD, + AST_OP, + AST_PARENT, }; /* diff --git a/include/eval.h b/include/eval.h index 60d6f23..97c1ce8 100644 --- a/include/eval.h +++ b/include/eval.h @@ -6,7 +6,7 @@ /* By: charles <charles@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:30 by charles #+# #+# */ -/* Updated: 2020/06/18 13:38:53 by charles ### ########.fr */ +/* Updated: 2020/06/19 12:18:42 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,33 +22,13 @@ # include "lexer.h" # include "ast.h" -/* -** \brief Evaluation state struct -*/ - typedef struct { t_path path; t_env env; -} t_eval_state; - -/* -** \brief Evaluation status struct -*/ - -typedef struct s_eval_status -{ - char *err; - int status; -} t_eval_status; - -typedef struct -{ - t_eval_state *state; - t_op *op; - int fd_in; - int fd_out; -} t_fork_param_op; + t_ast *ast; + int fds[2]; +} t_fork_param_parent; typedef struct { @@ -66,7 +46,7 @@ typedef struct ** op.c */ -int eval_op(int fds[2], t_env env, t_path path, t_op *op); +int eval_op(int fds[2], t_env env, t_path path, t_ast *ast); int eval(int fds[2], t_env env, t_path path, t_ast *ast); enum e_error diff --git a/minishell_test b/minishell_test -Subproject d845a683e67a89c699109dab660f6ec0eb74a2c +Subproject 9ae06d1ada7828f986b8aa1ab9364ac2f9f0cbd diff --git a/src/debug.c b/src/debug.c new file mode 100644 index 0000000..dd0919e --- /dev/null +++ b/src/debug.c @@ -0,0 +1,61 @@ + +#include <stdio.h> +#include "lexer.h" +#include "ast.h" + +void token_debug(void *v) +{ + t_token *t; + + t= v; + printf("[%4d %d] (%s)\n", t->tag, !!(t->tag & TAG_STICK), t->content); +} + +void token_put(void *v) +{ + t_token *t; + + t= v; + printf("%s ", t->content); +} + +void print_level(int level) +{ + while (level-- > 0) + printf(" "); +} + +void ast_print(int level, t_ast *ast) +{ + if (ast->tag == AST_CMD) + { + print_level(level); + printf("cmd: [ "); + ft_lstiter(ast->cmd_argv, token_put); + printf(" ] redirs: ["); + ft_lstiter(ast->redirs, token_put); + printf(" ]"); + } + else + { + /* printf("SEP: %d\n", ast->op.sep); */ + print_level(level); + printf("redirs: ["); + ft_lstiter(ast->redirs, token_put); + printf(" ] "); + printf("{\n"); + + print_level(level); + printf(" left:\n"); + ast_print(level + 1, ast->op.left); + + printf("\n"); + print_level(level); + printf(" right:\n"); + ast_print(level + 1, ast->op.right); + + printf("\n"); + print_level(level); + printf("}\n"); + } +} @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:21:24 by cacharle #+# #+# */ -/* Updated: 2020/06/17 12:50:26 by charles ### ########.fr */ +/* Updated: 2020/06/18 14:33:26 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -69,7 +69,7 @@ char *env_search(t_env env, char *key) i = 0; while (i < env->size - 1) { - if (env_keycmp(env->data[i], key)) + if (env_keycmp(env->data[i], key) == 0) return (ft_strchr(env->data[i], '=') + 1); i++; } diff --git a/src/eval/cmd.c b/src/eval/cmd.c index f502984..4405cdd 100644 --- a/src/eval/cmd.c +++ b/src/eval/cmd.c @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/14 10:41:31 by charles #+# #+# */ -/* Updated: 2020/06/17 17:02:07 by charles ### ########.fr */ +/* Updated: 2020/06/19 12:03:13 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,6 +75,7 @@ int eval_cmd(int fds[2], t_env env, t_path path, t_ast *ast) return (-1); } + // can have no command (e.g `< file`) param.builtin = builtin_search_func(argv[0]); if (param.builtin == NULL) { diff --git a/src/eval/op.c b/src/eval/op.c index e47698b..b8ad63c 100644 --- a/src/eval/op.c +++ b/src/eval/op.c @@ -6,14 +6,13 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/17 15:27:22 by charles #+# #+# */ -/* Updated: 2020/06/17 17:03:48 by charles ### ########.fr */ +/* Updated: 2020/06/19 12:18:57 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "eval.h" -// TODO: add parent tag on first operation of parent to fork -int eval_op(int fds[2], t_env env, t_path path, t_op *op) +int eval_op(int fds[2], t_env env, t_path path, t_ast *ast) { int status; int left_fds[2]; @@ -24,25 +23,52 @@ int eval_op(int fds[2], t_env env, t_path path, t_op *op) left_fds[FDS_WRITE] = MS_NO_FD; right_fds[FDS_READ] = MS_NO_FD; right_fds[FDS_WRITE] = fds[FDS_WRITE]; - if (op->sep == TAG_PIPE) + if (ast->op.sep == TAG_PIPE) { pipe(p); left_fds[FDS_WRITE] = p[FDS_WRITE]; right_fds[FDS_READ] = p[FDS_READ]; } - if ((status = eval(left_fds, env, path, op->left)) == -1) + if (!redir_extract(ast->redirs, env, fds)) + { + ast->redirs = NULL; + return (-1); + } + ast->redirs = NULL; + if ((status = eval(left_fds, env, path, ast->op.left)) == -1) return (-1); - if ((op->sep == TAG_AND && status != 0) || - (op->sep == TAG_PIPE && status != 0) || - (op->sep == TAG_OR && status == 0)) + if ((ast->op.sep == TAG_AND && status != 0) || + (ast->op.sep == TAG_PIPE && status != 0) || + (ast->op.sep == TAG_OR && status == 0)) return (status); - return (eval(right_fds, env, path, op->right)); + return (eval(right_fds, env, path, ast->op.right)); +} + +int wrapped_eval(void *void_param) +{ + t_fork_param_parent *param; + + param = void_param; + return (eval(param->fds, param->env, param->path, param->ast)); } int eval(int fds[2], t_env env, t_path path, t_ast *ast) { + t_fork_param_parent param; + + // need to handle pipe and redir + if (ast->tag & AST_PARENT) + { + param.fds[0] = fds[0]; + param.fds[1] = fds[1]; + param.env = env; + param.path = path; + ast->tag ^= AST_PARENT; + param.ast = ast; + return (fork_wrap(fds, ¶m, wrapped_eval)); + } if (ast->tag == AST_OP) - return (eval_op(fds, env, path, &ast->op)); + return (eval_op(fds, env, path, ast)); if (ast->tag == AST_CMD) return (eval_cmd(fds, env, path, ast)); return (-1); @@ -6,7 +6,7 @@ /* By: cacharle <cacharle@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 11:45:44 by cacharle #+# #+# */ -/* Updated: 2020/06/18 14:57:30 by nahaddac ### ########.fr */ +/* Updated: 2020/06/19 13:30:40 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,186 +21,128 @@ #include "parser.h" #include "eval.h" - void token_debug(void *v) - { - t_token *t; +void token_debug(void *v); +void token_put(void *v); +void print_level(int level); +void ast_print(int level, t_ast *ast); - t= v; - printf("[%4d %d] (%s)\n", t->tag, !!(t->tag & TAG_STICK), t->content); - } +int main(int argc, char **argv, char **envp) +{ + t_path path; + t_env env; - int main(int argc, char **argv, char **envp) - { - t_path path; - t_env env; + env = env_from_array(envp); + path = path_update(NULL, env_search(env, "PATH")); + /* printf("%s\n", argv[2]); */ - env = env_from_array(envp); - path = path_update(NULL, env_search(env, "PATH")); - //#<{(| printf("%s\n", argv[2]); |)}># + if (argc == 3 && ft_strcmp(argv[1], "-c") == 0) + { + //printf("%s\n", argv[2]); + t_ftlst *lex_out = lexer(ft_strdup(argv[2])); + if (lex_out == NULL) + return (1); - if (argc == 3 && ft_strcmp(argv[1], "-c") == 0) - { - //printf("%s\n", argv[2]); - t_ftlst *lex_out = lexer(ft_strdup(argv[2])); - //ft_lstiter(lex_out, token_debug); + //ft_lstiter(lex_out, token_debug); - parse(lex_out); - // <{(| printf("===cmd_argv===\n"); |)}> - // <{(| ft_lstiter(parser_out->ast->cmd_argv, token_debug); |)}> - // <{(| printf("===redirs===\n"); |)}> - // <{(| ft_lstiter(parser_out->ast->redirs, token_debug); |)}> + t_ret *parser_out = parse(lex_out); + if (parser_out == NULL || parser_out->unexpected != NULL) + return (1); - //int fds[2] = {MS_NO_FD, MS_NO_FD}; - //int eval_out = eval_cmd(fds, env, path, parser_out->ast); - //(void)eval_out; - } + /* ast_print(0, parser_out->ast); */ - //ft_htdestroy(path, free); - //ft_vecdestroy(env, free); + /* printf("===cmd_argv===\n"); */ + /* ft_lstiter(parser_out->ast->cmd_argv, token_debug); */ + /* printf("===redirs===\n"); */ + /* ft_lstiter(parser_out->ast->redirs, token_debug); */ - return (0); + int fds[2] = {MS_NO_FD, MS_NO_FD}; + int eval_out = eval(fds, env, path, parser_out->ast); + (void)eval_out; + } + + ft_htdestroy(path, free); + ft_vecdestroy(env, free); + return (0); } -// void token_put(void *v) -// { -// t_token *t; -// -// t= v; -// printf("%s ", t->content); -// } -// -// void print_level(int level) -// { -// while (level-- > 0) -// printf(" "); -// } -// -// void ast_print(int level, t_ast *ast) -// { -// if (ast->tag == AST_CMD) -// { -// print_level(level); -// printf("cmd: [ "); -// ft_lstiter(ast->cmd_argv, token_put); -// printf(" ] redirs: ["); -// ft_lstiter(ast->redirs, token_put); -// printf(" ]"); -// } -// else -// { -// /* print_level(level); */ -// /* printf("SEP: %d\n", ast->op.sep); */ -// print_level(level); -// printf("{\n"); -// -// print_level(level); -// printf(" left:\n"); -// ast_print(level + 1, ast->op.left); -// -// printf("\n"); -// print_level(level); -// printf(" right:\n"); -// ast_print(level + 1, ast->op.right); -// -// printf("\n"); -// print_level(level); -// printf("}\n"); -// } -// } - -// int main(int argc, char **argv, char **envp) -// { -// (void)argc; -// (void)argv; -// /* (void)envp; */ -// t_path path; -// t_env env; -// /* char *line; */ -// /* int ret; */ -// env = env_from_array(envp); -// path = path_update(NULL, env_search(env, "PATH")); -// -// t_ftlst *args1 = NULL; -// ft_lstpush_back(&args1, ft_lstnew(token_new(TAG_STR, "ls"))); -// ft_lstpush_back(&args1, ft_lstnew(token_new(TAG_STR, "-l"))); -// -// t_ftlst *args2 = NULL; -// ft_lstpush_back(&args2, ft_lstnew(token_new(TAG_STR, "cat"))); -// ft_lstpush_back(&args2, ft_lstnew(token_new(TAG_STR, "-e"))); -// /* ft_lstpush_back(&args2, ft_lstnew(token_new(TAG_STR, "je"))); */ -// -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "ls"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "-a"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "-l"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "$$LFS$TERM$TERM."))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "*.c"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "src.c include*.h"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "$A$B"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "\\$TERM"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "$TER\\M"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "\\\\"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_SINGLE, "''''$TEST\\TEST"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE, ",$TEST,$B,"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE | TAG_STICK, "$TEST"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE | TAG_STICK, "$TEST"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE , "$TEST"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE | TAG_STICK, "$TEST"))); */ -// /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_SINGLE, "$TEST"))); */ -// -// t_ftlst *redirs = NULL; -// ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_REDIR_OUT, NULL))); -// ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_STR, "bonjour"))); -// /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_REDIR_APPEND, NULL))); */ -// /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_STR, "yo"))); */ -// /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_REDIR_OUT, NULL))); */ -// /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_STR, "yo1"))); */ -// -// t_ast *cmd1 = ast_new(AST_CMD); -// cmd1->cmd_argv = args1; -// cmd1->redirs = NULL; -// -// t_ast *cmd2 = ast_new(AST_CMD); -// cmd2->cmd_argv = args2; -// cmd2->redirs = NULL; -// -// t_ast *op_ast = ast_new(AST_OP); -// op_ast->op.left = cmd1; -// op_ast->op.right = cmd2; -// op_ast->op.sep = TAG_PIPE; -// -// -// int fds[2] = {MS_NO_FD, MS_NO_FD}; -// printf("eval %d\n", eval(fds, env, path, op_ast)); -// -// /* char **as = preprocess(l, env); */ -// /* printf("%p\n", as); */ -// /* printf("%p\n", *as); */ -// /* char **tmp = as; */ -// /* while (*as != NULL) */ -// /* puts(*as++); */ -// /* ft_split_destroy(tmp); */ -// ft_htdestroy(path, free); -// ft_vecdestroy(env, free); -// return (0); -// } - -///////////////////////////////////////////////////////////////////////////////////////// -// lexer main -///////////////////////////////////////////////////////////////////////////////////////// - -/* int main(int argc, char **argv) */ + + + +///////////////////////////////////////////////////////////// +// eval +///////////////////////////////////////////////////////////// + +/* int main(int argc, char **argv, char **envp) */ /* { */ -/* char *input; */ -/* t_ftlst *lst; */ -/* */ -/* if (argv[1] == NULL) */ -/* return (0); */ -/* if (!(input = malloc(sizeof(char) * ft_strlen(argv[1]) + 1))) */ -/* return(0); */ -/* ft_strlcpy(input, argv[1], ft_strlen(argv[1]) + 1); */ -/* */ -/* lst = lexer(input); */ -/* parse(lst); */ -/* free(input); */ -/* exit(0); */ -/* return (0); */ + /* (void)argc; */ + /* (void)argv; */ + /* (void)envp; */ + /* t_path path; */ + /* t_env env; */ + /* char *line; */ + /* int ret; */ + /* env = env_from_array(envp); */ + /* path = path_update(NULL, env_search(env, "PATH")); */ + + /* t_ftlst *args1 = NULL; */ + /* ft_lstpush_back(&args1, ft_lstnew(token_new(TAG_STR, "ls"))); */ + /* ft_lstpush_back(&args1, ft_lstnew(token_new(TAG_STR, "-l"))); */ + + /* t_ftlst *args2 = NULL; */ + /* ft_lstpush_back(&args2, ft_lstnew(token_new(TAG_STR, "cat"))); */ + /* ft_lstpush_back(&args2, ft_lstnew(token_new(TAG_STR, "-e"))); */ + /* ft_lstpush_back(&args2, ft_lstnew(token_new(TAG_STR, "je"))); */ + + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "ls"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "-a"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "-l"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "$$LFS$TERM$TERM."))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "*.c"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "src.c include*.h"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "$A$B"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "\\$TERM"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "$TER\\M"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR, "\\\\"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_SINGLE, "''''$TEST\\TEST"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE, ",$TEST,$B,"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE | TAG_STICK, "$TEST"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE | TAG_STICK, "$TEST"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE , "$TEST"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_DOUBLE | TAG_STICK, "$TEST"))); */ + /* ft_lstpush_back(&args, ft_lstnew(token_new(TAG_STR_SINGLE, "$TEST"))); */ + + /* t_ftlst *redirs = NULL; */ + /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_REDIR_OUT, NULL))); */ + /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_STR, "bonjour"))); */ + /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_REDIR_APPEND, NULL))); */ + /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_STR, "yo"))); */ + /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_REDIR_OUT, NULL))); */ + /* ft_lstpush_back(&redirs, ft_lstnew(token_new(TAG_STR, "yo1"))); */ + + /* t_ast *cmd1 = ast_new(AST_CMD); */ + /* cmd1->cmd_argv = args1; */ + /* cmd1->redirs = NULL; */ + + /* t_ast *cmd2 = ast_new(AST_CMD); */ + /* cmd2->cmd_argv = args2; */ + /* cmd2->redirs = NULL; */ + + /* t_ast *op_ast = ast_new(AST_OP); */ + /* op_ast->op.left = cmd1; */ + /* op_ast->op.right = cmd2; */ + /* op_ast->op.sep = TAG_PIPE; */ + + + /* int fds[2] = {MS_NO_FD, MS_NO_FD}; */ + /* printf("eval %d\n", eval_cmd(fds, env, path, cmd1)); */ + + /* char **as = preprocess(l, env); */ + /* printf("%p\n", as); */ + /* printf("%p\n", *as); */ + /* char **tmp = as; */ + /* while (*as != NULL) */ + /* puts(*as++); */ + /* ft_split_destroy(tmp); */ +/* ft_htdestroy(path, free); */ +/* ft_vecdestroy(env, free); */ +/* return (0); */ /* } */ |
