42-archive/42sh/src/exec/exec_dgreat.c
2016-12-13 17:59:58 +01:00

27 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exec_dgreat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 18:15:13 by jhalford #+# #+# */
/* Updated: 2016/12/13 17:13:58 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
int exec_dgreat(t_btree **ast)
{
t_astnode *node;
int fd;
node = (*ast)->item;
fd = open(node->data.redir.word.word, O_WRONLY | O_APPEND | O_CREAT, 0644);
data_singleton()->exec.process.fdout = fd;
ft_exec(&(*ast)->left);
data_singleton()->exec.process.fdout = STDOUT;
btree_delone(ast, &ast_free);
return (0);
}