diff --git a/42sh/src/exec/redirect_dless.c b/42sh/src/exec/redirect_dless.c index d8063a57..e204d3c3 100644 --- a/42sh/src/exec/redirect_dless.c +++ b/42sh/src/exec/redirect_dless.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 12:36:10 by jhalford #+# #+# */ -/* Updated: 2017/03/25 01:45:49 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 19:41:50 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,6 @@ int redirect_dless(t_redir *redir) str = redir->heredoc_data; write(fds[PIPE_WRITE], str, ft_strlen(str)); close(fds[PIPE_WRITE]); - dup2(fds[PIPE_READ], redir->n); - close(fds[PIPE_READ]); + fd_replace(fds[PIPE_READ], redir->n); return (0); } diff --git a/42sh/src/lexer/get_state_global.c b/42sh/src/lexer/get_state_global.c index 8ebe2f0a..dc7bedc0 100644 --- a/42sh/src/lexer/get_state_global.c +++ b/42sh/src/lexer/get_state_global.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */ -/* Updated: 2017/03/27 19:18:47 by ariard ### ########.fr */ +/* Updated: 2017/03/27 19:56:59 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,8 +32,7 @@ t_lexstate get_state_global(t_lexer *lexer) || ((c == '`') && (ret = BQUOTE)) || ((c == '(' || c == ')') && (ret = PAREN)) || (((c == '{' && (cn == ' ' || cn == 0)) - || (c == '}' && (cl == ' ' || cl == 0))) - && (ret = CURLY_BRACKETS)) + || (c == '}' && (cl == ' ' || cl == 0))) && (ret = CURLY_BRACKETS)) || ((c == 0) && (ret = END))) { ; diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index 542f1780..bfd6768d 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ -/* Updated: 2017/03/27 18:08:56 by jhalford ### ########.fr */ +/* Updated: 2017/03/27 19:41:47 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -100,5 +100,6 @@ int shell_init(int ac, char **av, char **env) if (SH_IS_INTERACTIVE(data->opts) && interactive_settings() < 0) return (-1); shell_fds_init(); + shell_fds_push(); return (0); }