From 55b72823cb2c6c2f407656fdb80bdcb8da744eb5 Mon Sep 17 00:00:00 2001 From: Antoine Riard Date: Mon, 13 Mar 2017 14:06:54 +0100 Subject: [PATCH] before pull --- 42sh/.gitignore | 5 +++++ 42sh/Makefile | 2 +- 42sh/fewefwfew | 1 + 42sh/file | 1 + 42sh/includes/minishell.h | 2 +- 42sh/includes/types.h | 2 +- 42sh/new_file_stderr_and_stdout | 2 ++ 42sh/src/glob/word_is_assignment.c | 3 +-- 42sh/src/lexer/lexer_assignement_word.c | 4 ++-- 42sh/src/lexer/lexer_number.c | 2 +- 42sh/src/lexer/lexer_word.c | 2 +- 42sh/src/main/main.c | 4 ++-- 42sh/src/parser/add_cmd.c | 7 ++++++- 42sh/src/parser/add_redir.c | 7 +++++-- 42sh/src/parser/add_redir_condition.c | 2 +- 42sh/src/parser/aggregate_sym.c | 2 +- 42sh/src/parser/heredoc_parser.c | 2 +- 17 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 42sh/fewefwfew create mode 100644 42sh/file create mode 100644 42sh/new_file_stderr_and_stdout diff --git a/42sh/.gitignore b/42sh/.gitignore index cfd0396b..202ebc2f 100644 --- a/42sh/.gitignore +++ b/42sh/.gitignore @@ -13,3 +13,8 @@ debug *.swn STDBUG STDEBUG +display_env +read_on_stdin +write_on_stderr +write_on_stdout +write_on_stdout_and_stderr diff --git a/42sh/Makefile b/42sh/Makefile index 8ebd44b6..acf4b7a3 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/10 17:40:02 by gwojda ### ########.fr # +# Updated: 2017/03/12 15:48:20 by ariard ### ########.fr # # # # **************************************************************************** # diff --git a/42sh/fewefwfew b/42sh/fewefwfew new file mode 100644 index 00000000..6a017133 --- /dev/null +++ b/42sh/fewefwfew @@ -0,0 +1 @@ +cat: weffwe: No such file or directory diff --git a/42sh/file b/42sh/file new file mode 100644 index 00000000..dd20028e --- /dev/null +++ b/42sh/file @@ -0,0 +1 @@ +ffewfe2 diff --git a/42sh/includes/minishell.h b/42sh/includes/minishell.h index 6627e316..21c50f1b 100644 --- a/42sh/includes/minishell.h +++ b/42sh/includes/minishell.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */ -/* Updated: 2017/03/10 19:59:56 by ariard ### ########.fr */ +/* Updated: 2017/03/12 01:01:44 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/includes/types.h b/42sh/includes/types.h index 1254a88f..74b54da2 100644 --- a/42sh/includes/types.h +++ b/42sh/includes/types.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */ -/* Updated: 2017/03/11 16:40:08 by jhalford ### ########.fr */ +/* Updated: 2017/03/12 01:01:33 by ariard ### ########.fr */ /* Updated: 2017/03/07 18:35:11 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/new_file_stderr_and_stdout b/42sh/new_file_stderr_and_stdout new file mode 100644 index 00000000..0eab0827 --- /dev/null +++ b/42sh/new_file_stderr_and_stdout @@ -0,0 +1,2 @@ +TOKEN201703111831_1 +TOKEN201703111831_2 diff --git a/42sh/src/glob/word_is_assignment.c b/42sh/src/glob/word_is_assignment.c index d0908d23..e4dc0de8 100644 --- a/42sh/src/glob/word_is_assignment.c +++ b/42sh/src/glob/word_is_assignment.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 18:59:11 by wescande #+# #+# */ -/* Updated: 2017/03/07 21:20:53 by wescande ### ########.fr */ +/* Updated: 2017/03/11 20:47:05 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,4 +32,3 @@ int word_is_assignment(char **content) } return (1); } - diff --git a/42sh/src/lexer/lexer_assignement_word.c b/42sh/src/lexer/lexer_assignement_word.c index 2f802e33..9227565b 100644 --- a/42sh/src/lexer/lexer_assignement_word.c +++ b/42sh/src/lexer/lexer_assignement_word.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/24 20:28:13 by ariard #+# #+# */ -/* Updated: 2017/03/07 18:36:23 by jhalford ### ########.fr */ +/* Updated: 2017/03/11 20:48:34 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,6 +32,6 @@ int lexer_assignement_word(t_list **alst, t_lexer *lexer) return (lexer_lex(alst, lexer)); if ((lexer->state = get_state_redir(lexer))) return (lexer_lex(alst, lexer)); - lexer->state = ft_isdigit(c) ? NUMBER : ASSIGNEMENT_WORD; + lexer->state = ASSIGNEMENT_WORD; return(lexer_lex(alst, lexer)); } diff --git a/42sh/src/lexer/lexer_number.c b/42sh/src/lexer/lexer_number.c index b63ac61a..80401358 100644 --- a/42sh/src/lexer/lexer_number.c +++ b/42sh/src/lexer/lexer_number.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:06:45 by jhalford #+# #+# */ -/* Updated: 2017/03/10 13:12:43 by jhalford ### ########.fr */ +/* Updated: 2017/03/11 20:48:19 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/lexer_word.c b/42sh/src/lexer/lexer_word.c index b2643688..1ac6cad3 100644 --- a/42sh/src/lexer/lexer_word.c +++ b/42sh/src/lexer/lexer_word.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:07:11 by jhalford #+# #+# */ -/* Updated: 2017/03/08 23:36:13 by ariard ### ########.fr */ +/* Updated: 2017/03/11 20:46:32 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index a5fb2b2e..adbc9de5 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/03/11 19:56:53 by ariard ### ########.fr */ +/* Updated: 2017/03/11 20:05:07 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -70,7 +70,7 @@ int handle_instruction(int fd) return (error_syntax(&token, &parser, &ast)); } } - ft_show_heredoc_data(&ast); +// ft_show_heredoc_data(&ast); btree_print(STDBUG, ast, &ft_putast); if (ft_exec(&ast)) return (1); diff --git a/42sh/src/parser/add_cmd.c b/42sh/src/parser/add_cmd.c index c0cdadaf..929ad950 100644 --- a/42sh/src/parser/add_cmd.c +++ b/42sh/src/parser/add_cmd.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 20:49:15 by ariard #+# #+# */ -/* Updated: 2017/03/11 15:34:23 by ariard ### ########.fr */ +/* Updated: 2017/03/11 20:07:57 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -74,8 +74,13 @@ int add_cmd(t_btree **ast, t_list **lst) i = -1; while (++i < 19) + { if (g_distrostree[i].test(ast, lst) == 1) + { + DG("add to %d", i); return (g_distrostree[i].add(ast, lst)); + } + } if (!*ast) gen_node(ast); else if (no_del_token(ast, lst)) diff --git a/42sh/src/parser/add_redir.c b/42sh/src/parser/add_redir.c index 9737eea1..4775300b 100644 --- a/42sh/src/parser/add_redir.c +++ b/42sh/src/parser/add_redir.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/17 16:39:05 by ariard #+# #+# */ -/* Updated: 2017/03/11 19:57:02 by ariard ### ########.fr */ +/* Updated: 2017/03/11 20:36:19 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -52,7 +52,10 @@ int isdir_word(t_btree **ast, t_list **list) node = (*ast)->item; if (token->type == TK_WORD && node->type == REDIR) { - node->type = node->cache; + if (node->cache != TK_NEWLINE) + node->type = node->cache; + else + node->type = CMD; node->cache = 0; return (1); } diff --git a/42sh/src/parser/add_redir_condition.c b/42sh/src/parser/add_redir_condition.c index bf1a1ed4..30569f8d 100644 --- a/42sh/src/parser/add_redir_condition.c +++ b/42sh/src/parser/add_redir_condition.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/11 14:54:18 by ariard #+# #+# */ -/* Updated: 2017/03/11 15:54:52 by ariard ### ########.fr */ +/* Updated: 2017/03/11 20:05:41 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/aggregate_sym.c b/42sh/src/parser/aggregate_sym.c index 596eb9fa..adce88c6 100644 --- a/42sh/src/parser/aggregate_sym.c +++ b/42sh/src/parser/aggregate_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/11 15:58:38 by ariard #+# #+# */ -/* Updated: 2017/03/11 16:05:58 by ariard ### ########.fr */ +/* Updated: 2017/03/12 00:50:41 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/heredoc_parser.c b/42sh/src/parser/heredoc_parser.c index ee34ac8c..6a483318 100644 --- a/42sh/src/parser/heredoc_parser.c +++ b/42sh/src/parser/heredoc_parser.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 16:21:05 by ariard #+# #+# */ -/* Updated: 2017/03/11 19:40:43 by ariard ### ########.fr */ +/* Updated: 2017/03/11 20:01:42 by ariard ### ########.fr */ /* */ /* ************************************************************************** */