diff --git a/42sh/Makefile b/42sh/Makefile index d500f869..c8714fb5 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/21 11:05:18 by gwojda ### ########.fr # +# Updated: 2017/03/21 13:38:09 by jhalford ### ########.fr # # # # **************************************************************************** # diff --git a/42sh/libft/src/get_next_line/get_next_line.c b/42sh/libft/src/get_next_line/get_next_line.c index efe575cd..f6462feb 100644 --- a/42sh/libft/src/get_next_line/get_next_line.c +++ b/42sh/libft/src/get_next_line/get_next_line.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/15 13:12:06 by jhalford #+# #+# */ -/* Updated: 2017/03/21 01:17:07 by wescande ### ########.fr */ +/* Updated: 2017/03/21 13:16:15 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/sample/subshell_pipe b/42sh/sample/subshell_pipe new file mode 100644 index 00000000..36c34cd1 --- /dev/null +++ b/42sh/sample/subshell_pipe @@ -0,0 +1,10 @@ +echo aaa \ + | (echo bbb 1; cat -e ;echo ccc 1) \ + | (echo bbb 2; cat -e ;echo ccc 2) \ + | (echo bbb 3; cat -e ;echo ccc 3) \ + | (echo bbb 4; cat -e ;echo ccc 4) \ + | (echo bbb 5; cat -e ;echo ccc 5) \ + | (echo bbb 6; cat -e ;echo ccc 6) \ + | (echo bbb 7; cat -e ;echo ccc 7) \ + | (echo bbb 8; cat -e ;echo ccc 8) \ + | (echo bbb 9; cat -e ;echo ccc 9) diff --git a/42sh/src/builtin/builtin_exit.c b/42sh/src/builtin/builtin_exit.c index c7a13a4f..573c0004 100644 --- a/42sh/src/builtin/builtin_exit.c +++ b/42sh/src/builtin/builtin_exit.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */ -/* Updated: 2017/03/21 01:44:13 by ariard ### ########.fr */ +/* Updated: 2017/03/21 13:50:00 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,7 +32,7 @@ int builtin_exit(const char *path, char *const av[], char *const envp[]) data_singleton()->argv[0]); return (0); } - if (av[1] && !ft_stris(av[1], ft_isdigit)) + if (av && av[1] && !ft_stris(av[1], ft_isdigit)) error_msg(EXITERR_0); status = (av && av[1]) ? ft_atoi(av[1]) : ft_atoi(ft_getenv(data_singleton()->env, "?")); diff --git a/42sh/src/exec/exec_leaf.c b/42sh/src/exec/exec_leaf.c index 7c099811..60ac11d6 100644 --- a/42sh/src/exec/exec_leaf.c +++ b/42sh/src/exec/exec_leaf.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 15:47:30 by wescande #+# #+# */ -/* Updated: 2017/03/21 01:21:04 by wescande ### ########.fr */ +/* Updated: 2017/03/21 13:16:25 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/mark_process_status.c b/42sh/src/exec/mark_process_status.c index 1e6c0f04..a4436b64 100644 --- a/42sh/src/exec/mark_process_status.c +++ b/42sh/src/exec/mark_process_status.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */ -/* Updated: 2017/03/20 14:33:51 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 13:41:58 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,7 @@ int mark_process_status(pid_t pid, int status) else { p->state = PROCESS_COMPLETED; - if (WIFSIGNALED(status)) + if (WIFSIGNALED(status) && WTERMSIG(status) != SIGPIPE) ft_dprintf(2, "%s\n", strsignal((WTERMSIG(status)))); } return (0); diff --git a/42sh/src/exec/process_resetfds.c b/42sh/src/exec/process_resetfds.c index aae6ee4c..f7ddf33c 100644 --- a/42sh/src/exec/process_resetfds.c +++ b/42sh/src/exec/process_resetfds.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/09 14:51:23 by jhalford #+# #+# */ -/* Updated: 2017/03/20 20:25:06 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 13:16:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/history/list_toolz.c b/42sh/src/history/list_toolz.c index 71b6e9be..08959e48 100644 --- a/42sh/src/history/list_toolz.c +++ b/42sh/src/history/list_toolz.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */ -/* Updated: 2017/03/20 21:25:22 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 13:37:25 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_backslash.c b/42sh/src/lexer/lexer_backslash.c index 36af22c4..e9970a94 100644 --- a/42sh/src/lexer/lexer_backslash.c +++ b/42sh/src/lexer/lexer_backslash.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:56:49 by jhalford #+# #+# */ -/* Updated: 2017/03/17 21:01:45 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 13:42:01 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,6 +22,8 @@ int lexer_backslash(t_list **alst, t_lexer *lexer) lexer->state = WORD; if (lexer->str[lexer->pos] == 0) { + if (!*token->data) + ft_lst_delif(alst, token, &ft_addrcmp, &token_free); push(&lexer->stack, BACKSLASH); return (0); } diff --git a/42sh/src/lexer/lexer_delim.c b/42sh/src/lexer/lexer_delim.c index 4bd59d71..260dfc1c 100644 --- a/42sh/src/lexer/lexer_delim.c +++ b/42sh/src/lexer/lexer_delim.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:58:44 by jhalford #+# #+# */ -/* Updated: 2017/03/20 15:32:07 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 13:33:58 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_end.c b/42sh/src/lexer/lexer_end.c index bae21bae..fc6f2844 100644 --- a/42sh/src/lexer/lexer_end.c +++ b/42sh/src/lexer/lexer_end.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/05 16:58:24 by jhalford #+# #+# */ -/* Updated: 2017/03/16 23:17:09 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 13:16:57 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/data_exit.c b/42sh/src/main/data_exit.c index 51f33403..dfaf2006 100644 --- a/42sh/src/main/data_exit.c +++ b/42sh/src/main/data_exit.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */ -/* Updated: 2017/03/20 21:25:25 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 13:42:07 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 7f326eb5..723fd95d 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ -/* Updated: 2017/03/20 23:12:42 by ariard ### ########.fr */ +/* Updated: 2017/03/21 13:39:17 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -52,7 +52,6 @@ static int handle_instruction(t_list **token, t_btree **ast) set_exitstatus(1, 1); if (SH_IS_INTERACTIVE(data->opts) && data->lexer.str) ft_add_str_in_history(data->lexer.str); - /* exit(0); */ return (0); }