diff --git a/42sh/Makefile b/42sh/Makefile index ce3e375c..cfce41bd 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\ @@ -97,7 +98,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\ @@ -236,12 +236,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 318efc7c..6a6a23b2 160000 --- a/42sh/libft +++ b/42sh/libft @@ -1 +1 @@ -Subproject commit 318efc7cfb7b7cc9d3714fa19fd2be7382b6adec +Subproject commit 6a6a23b2839a5ec7322bdc6adbb2d3dad3d1023c 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}, }; diff --git a/42sh/src/exec/exec_math.c b/42sh/src/exec/exec_math.c index c44ea5f9..e157ef4c 100644 --- a/42sh/src/exec/exec_math.c +++ b/42sh/src/exec/exec_math.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 10:58:49 by ariard #+# #+# */ -/* Updated: 2017/03/07 13:33:49 by ariard ### ########.fr */ +/* Updated: 2017/03/07 13:42:11 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/exec_var.c b/42sh/src/exec/exec_var.c index ac98e0cb..b01c2f39 100644 --- a/42sh/src/exec/exec_var.c +++ b/42sh/src/exec/exec_var.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 11:12:05 by ariard #+# #+# */ -/* Updated: 2017/03/07 12:17:13 by ariard ### ########.fr */ +/* Updated: 2017/03/07 14:40:30 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ 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; } 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); diff --git a/42sh/src/parser/add_var.c b/42sh/src/parser/add_var.c index db9ce5c2..661446b4 100644 --- a/42sh/src/parser/add_var.c +++ b/42sh/src/parser/add_var.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/03 15:08:16 by ariard #+# #+# */ -/* Updated: 2017/03/07 10:47:43 by ariard ### ########.fr */ +/* Updated: 2017/03/07 14:40:21 by ariard ### ########.fr */ /* */ /* ************************************************************************** */