diff --git a/Makefile b/Makefile index 8d237cd..6448337 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: vtarasiu +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2018/03/24 10:11:17 by vtarasiu #+# #+# # -# Updated: 2019/05/14 20:42:19 by vtarasiu ### ########.fr # +# Updated: 2019/05/16 13:05:03 by vtarasiu ### ########.fr # # # # **************************************************************************** # @@ -16,12 +16,10 @@ CC = clang FDS = shell(ulimit -n) -FLAGS = -g -DSH=\"$(NAME)\" \ +FLAGS = -DSH=\"$(NAME)\" \ -Wall \ -Wextra \ - -Werror \ - #-fprofile-instr-generate \ - #-fsanitize="address" + -Werror HEADER = -I include/ -I printf/include -I libft/ SRC_DIR = ./src/ diff --git a/include/twenty_one_sh.h b/include/twenty_one_sh.h index f3b9f2d..3c4aabb 100644 --- a/include/twenty_one_sh.h +++ b/include/twenty_one_sh.h @@ -6,7 +6,7 @@ /* By: vtarasiu +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/12/07 18:12:03 by vtarasiu #+# #+# */ -/* Updated: 2019/05/15 13:29:08 by vtarasiu ### ########.fr */ +/* Updated: 2019/05/16 13:05:17 by vtarasiu ### ########.fr */ /* */ /* ************************************************************************** */ @@ -70,8 +70,8 @@ # define ERR_RUNNING_JOBS ANSI_RESET SH ": you have running jobs\n" # define ERR_AMBIGUOUS_REDIRECT ANSI_RESET SH ": ambiguous redirect\n" -# define BUILD 2424 -# define BUILD_DATE "15.05.19 13:29:08 EEST" +# define BUILD 2459 +# define BUILD_DATE "16.05.19 13:05:16 EEST" # ifdef MAX_INPUT # undef MAX_INPUT diff --git a/src/ast/exec_pipeline.c b/src/ast/exec_pipeline.c index 48ad12b..b1403e4 100644 --- a/src/ast/exec_pipeline.c +++ b/src/ast/exec_pipeline.c @@ -47,6 +47,12 @@ static int exec_pipeline_inner(const t_node *node, int pp[2]; t_context *context_left; + if (node->left->node_type == NODE_SUBSHELL || + node->right->node_type == NODE_SUBSHELL) + { + ft_dprintf(2, SH ": subshells inside pipes are illegal\n"); + return (127); + } if (node->left->node_type == NODE_COMMAND && node->right->node_type == NODE_COMMAND) return (exec_pipeline_terminator(node, context_right)); diff --git a/src/ast/syntax_rules.c b/src/ast/syntax_rules.c index 271537d..d0f56ff 100644 --- a/src/ast/syntax_rules.c +++ b/src/ast/syntax_rules.c @@ -6,7 +6,7 @@ /* By: vtarasiu +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/12/03 16:28:37 by vtarasiu #+# #+# */ -/* Updated: 2019/05/14 17:30:00 by vtarasiu ### ########.fr */ +/* Updated: 2019/05/15 19:32:02 by vtarasiu ### ########.fr */ /* */ /* ************************************************************************** */ @@ -154,7 +154,7 @@ const t_rule g_compound_command = { const t_rule g_subshell = { .token = TOKEN_NOT_APPLICABLE, .expands_to = { - {&g_lbracket_token, &g_compound_list, &g_rbracket_token} + {&g_lbracket_token, &g_list, &g_rbracket_token} }, .human_readable = "subshell", .tree_builder = &subshell_build @@ -358,7 +358,7 @@ const t_rule g_term_rule_dash = { const t_rule g_brace_group = { .token = TOKEN_NOT_APPLICABLE, .expands_to = { - {&g_lbrace_token, &g_compound_list, &g_rbrace_token} + {&g_lbrace_token, &g_list, &g_rbrace_token} }, .human_readable = "brace_group", .tree_builder = NULL diff --git a/src/ast/tree_pipe_sequence.c b/src/ast/tree_pipe_sequence.c index f30546e..132ece6 100644 --- a/src/ast/tree_pipe_sequence.c +++ b/src/ast/tree_pipe_sequence.c @@ -6,7 +6,7 @@ /* By: vtarasiu +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/02 13:13:27 by vtarasiu #+# #+# */ -/* Updated: 2019/03/04 18:48:57 by vtarasiu ### ########.fr */ +/* Updated: 2019/05/15 17:02:58 by vtarasiu ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/ast/tree_subshell.c b/src/ast/tree_subshell.c index b611f06..58da412 100644 --- a/src/ast/tree_subshell.c +++ b/src/ast/tree_subshell.c @@ -6,7 +6,7 @@ /* By: vtarasiu +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/03 18:08:28 by vtarasiu #+# #+# */ -/* Updated: 2019/03/04 18:48:56 by vtarasiu ### ########.fr */ +/* Updated: 2019/05/15 17:45:48 by vtarasiu ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/expansions/expand_vars.c b/src/expansions/expand_vars.c index 8e5365e..1dbdc4e 100644 --- a/src/expansions/expand_vars.c +++ b/src/expansions/expand_vars.c @@ -86,7 +86,7 @@ char *expand_vars(char *str) while (i < len) { ignore = check_ignore(str, i, ignore); - if (ignore != QUOTE && str[i] == '$' && i + 1 != len && + if (ignore != QUOTE && str[i] == '$' && i + 1 != len && ft_isascii(str[i + 1])) { swap = str;