From dea350d9256a909d780610352fc21c871cd40b66 Mon Sep 17 00:00:00 2001 From: gwojda Date: Tue, 7 Mar 2017 11:21:21 +0100 Subject: [PATCH 1/4] fixe bug history --- 42sh/src/line-editing/readline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/42sh/src/line-editing/readline.c b/42sh/src/line-editing/readline.c index 770d2163..f9bf13df 100644 --- a/42sh/src/line-editing/readline.c +++ b/42sh/src/line-editing/readline.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */ -/* Updated: 2017/03/04 16:50:05 by ariard ### ########.fr */ +/* Updated: 2017/03/07 11:20:27 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,6 +39,8 @@ void ft_init_history(void) return ; while (get_next_line(fd, &str) > 0) { + if (!*str) + continue ; ft_push_back_history(&data_singleton()->line.list_beg, ft_create_history_list(str)); free(str); From 1c41155c50b3cc3bc95789ab515a6bc17dab3dce Mon Sep 17 00:00:00 2001 From: gwojda Date: Tue, 7 Mar 2017 11:24:20 +0100 Subject: [PATCH 2/4] =?UTF-8?q?on=20a=20retrouv=C3=A9=20le=20builtin=20his?= =?UTF-8?q?tory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 42sh/src/builtin/is_builtin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/42sh/src/builtin/is_builtin.c b/42sh/src/builtin/is_builtin.c index c0f39c2f..43a9aa27 100644 --- a/42sh/src/builtin/is_builtin.c +++ b/42sh/src/builtin/is_builtin.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ -/* Updated: 2017/03/02 21:00:13 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 11:05:55 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,6 +27,7 @@ t_stof g_builtin[] = {"bg", &builtin_bg}, {"read", &builtin_read}, {"hash", &builtin_hash}, + {"history", &builtin_history}, {NULL, NULL}, }; From 6c2dbb0a57890abd8d35de68e416ae60af68fb39 Mon Sep 17 00:00:00 2001 From: wescande Date: Tue, 7 Mar 2017 12:11:13 +0100 Subject: [PATCH 3/4] expansion des variables locales au shell. --- 42sh/src/glob/expand_var.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/42sh/src/glob/expand_var.c b/42sh/src/glob/expand_var.c index 31453a98..ed163a76 100644 --- a/42sh/src/glob/expand_var.c +++ b/42sh/src/glob/expand_var.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 16:09:27 by wescande #+# #+# */ -/* Updated: 2017/03/03 20:38:36 by wescande ### ########.fr */ +/* Updated: 2017/03/07 12:07:53 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -73,7 +73,8 @@ void expand_var(t_glob *gl) { if (var && *var) { - content = ft_getenv(data_singleton()->env, var); + if (!(content = ft_getenv(data_singleton()->env, var))) + content = ft_getenv(data_singleton()->local_var, var); insert_var(gl, pat, var, content); pat = gl->pat; } From 7ae114fd554e1d1ae9d4a2da125c05151355cefb Mon Sep 17 00:00:00 2001 From: wescande Date: Tue, 7 Mar 2017 12:19:10 +0100 Subject: [PATCH 4/4] permet la compilation en commentant exec_var --- 42sh/Makefile | 6 +++--- 42sh/libft | 2 +- 42sh/src/exec/exec_var.c | 9 ++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/42sh/Makefile b/42sh/Makefile index fe951535..b9ffe23a 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -60,6 +60,7 @@ completion/c_terminal.c\ completion/completion.c\ exec/ast_free.c\ exec/bad_fd.c\ +exec/error_badidentifier.c\ exec/exec_ampersand.c\ exec/exec_and_if.c\ exec/exec_case.c\ @@ -96,7 +97,6 @@ exec/redirect_less.c\ exec/redirect_lessand.c\ exec/set_exitstatus.c\ exec/set_process.c\ -exec/error_badidentifier.c\ glob/command_getoutput.c\ glob/dir_glob.c\ glob/esc_print.c\ @@ -235,12 +235,12 @@ parser/add_cmd.c\ parser/add_condition.c\ parser/add_func.c\ parser/add_loop.c\ +parser/add_math.c\ +parser/add_number.c\ parser/add_redir.c\ parser/add_sep.c\ parser/add_subshell.c\ parser/add_var.c\ -parser/add_number.c\ -parser/add_math.c\ parser/aggregate_sym.c\ parser/build_tree.c\ parser/error_syntax.c\ diff --git a/42sh/libft b/42sh/libft index dc155bf5..a966b8a2 160000 --- a/42sh/libft +++ b/42sh/libft @@ -1 +1 @@ -Subproject commit dc155bf51cc9de83df073669a1d2a9a915f16121 +Subproject commit a966b8a20028daba5580237fa0b0b18e16208f1b diff --git a/42sh/src/exec/exec_var.c b/42sh/src/exec/exec_var.c index 3bfc50ce..4eca2107 100644 --- a/42sh/src/exec/exec_var.c +++ b/42sh/src/exec/exec_var.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 17:33:53 by ariard #+# #+# */ -/* Updated: 2017/03/03 20:32:27 by wescande ### ########.fr */ +/* Updated: 2017/03/07 12:17:43 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,9 +14,12 @@ static int set_var(char *stream, char **var, char **value) { - *var = ft_strdupchr(stream, '='); + (void)stream; + (void)var; + (void)value; +/* *var = ft_strdupchr(stream, '='); stream += ft_strlenchr(stream, '=') + 1; - *value = ft_strdup(stream); + value = ft_strdup(stream);*/ return (0); }