This commit is contained in:
Jack Halford 2017-03-03 18:03:17 +01:00
parent 2ad34631e3
commit 03c62f69a6
7 changed files with 15 additions and 13 deletions

View file

@ -6,7 +6,7 @@
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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 #
# #
# **************************************************************************** #

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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++;

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 ? &ltoken : &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))