diff --git a/42sh/Makefile b/42sh/Makefile index 3b26beb7..e13fd4e3 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,7 +6,7 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/03/03 17:56:12 by jhalford ### ########.fr # +# Updated: 2017/03/03 17:58:15 by jhalford ### ########.fr # # # # **************************************************************************** # diff --git a/42sh/includes/lexer.h b/42sh/includes/lexer.h index 078b2005..12f76e17 100644 --- a/42sh/includes/lexer.h +++ b/42sh/includes/lexer.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */ -/* Updated: 2017/03/03 17:55:18 by jhalford ### ########.fr */ +/* Updated: 2017/03/03 17:58:18 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/exec_command.c b/42sh/src/exec/exec_command.c index cf915722..801cb235 100644 --- a/42sh/src/exec/exec_command.c +++ b/42sh/src/exec/exec_command.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */ -/* Updated: 2017/03/03 17:37:07 by jhalford ### ########.fr */ +/* Updated: 2017/03/03 17:59:42 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -49,6 +49,7 @@ int exec_cmd(t_btree **ast) job = &data_singleton()->exec.job; process_reset(&p); op = pop(&exec->op_stack); + DG("op=%i", op); fds[PIPE_WRITE] = STDOUT; fds[PIPE_READ] = STDIN; if (op == TK_AMP) diff --git a/42sh/src/exec/exec_semi.c b/42sh/src/exec/exec_semi.c index e8720350..58013f17 100644 --- a/42sh/src/exec/exec_semi.c +++ b/42sh/src/exec/exec_semi.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/30 20:52:05 by jhalford #+# #+# */ -/* Updated: 2017/03/03 16:26:08 by jhalford ### ########.fr */ +/* Updated: 2017/03/03 18:01:38 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,8 +17,11 @@ int exec_semi(t_btree **ast) t_exec *exec; exec = &data_singleton()->exec; + DG(); push(&exec->op_stack, TK_SEMI); + DG(); ft_exec(&(*ast)->left); + DG(); exec->attrs &= ~EXEC_AOL_MASK; ft_exec(&(*ast)->right); // btree_delone(ast, &ast_free); diff --git a/42sh/src/exec/ft_exec.c b/42sh/src/exec/ft_exec.c index e3579dc9..5d3b8090 100644 --- a/42sh/src/exec/ft_exec.c +++ b/42sh/src/exec/ft_exec.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */ -/* Updated: 2017/03/03 16:28:22 by jhalford ### ########.fr */ +/* Updated: 2017/03/03 18:02:55 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,7 @@ t_execmap g_execmap[] = {TK_ELSE, &exec_else}, {TK_UNTIL, &exec_until}, /* {TK_SUBSHELL, &exec_}, */ - {TK_WORD, &exec_cmd}, + {CMD, &exec_cmd}, {0, 0}, }; @@ -36,6 +36,7 @@ int ft_exec(t_btree **ast) int i; i = 0; + DG(); if (!*ast) return (0); item = (*ast)->item; @@ -43,8 +44,8 @@ int ft_exec(t_btree **ast) { if (item->type == g_execmap[i].type) { - /* DG("match : %s and %s", */ - /* read_state(item->type), read_state(g_execmap[i].type)); */ + DG("match : %s and %s", + read_state(item->type), read_state(g_execmap[i].type)); return ((*g_execmap[i].f)(ast)); } i++; diff --git a/42sh/src/lexer/lexer_newline.c b/42sh/src/lexer/lexer_newline.c index 396dc6d3..31b45b4b 100644 --- a/42sh/src/lexer/lexer_newline.c +++ b/42sh/src/lexer/lexer_newline.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/23 23:19:46 by ariard #+# #+# */ -/* Updated: 2017/02/09 19:55:04 by jhalford ### ########.fr */ +/* Updated: 2017/03/03 18:00:24 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 820abfb9..6e67591b 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/03/03 17:55:01 by jhalford ### ########.fr */ +/* Updated: 2017/03/03 17:58:44 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,10 +41,8 @@ int handle_instruction(int fd) else if (get_lexer_stack(lexer) == DLESS) lexer.state = DLESS; ltoken = ft_lstlast(token); - DG(); if (lexer_lex(token ? <oken : &token, &lexer)) return (1); - DG(); if (get_lexer_stack(lexer) > 1) continue ; lexer.state = DEFAULT; @@ -63,7 +61,6 @@ int handle_instruction(int fd) error_syntax(&token); token = NULL; } - DG(); DG("Before execution:"); btree_print(STDBUG, ast, &ft_putast); if (ft_exec(&ast))