From c19ee394f0f22a94670725dd381bf444eeefdf74 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Sat, 25 Mar 2017 20:26:29 +0100 Subject: [PATCH] close #197 --- 42sh/Makefile | 4 ++-- 42sh/src/history/add_str_in_history.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/42sh/Makefile b/42sh/Makefile index 6e004cc0..a4e0a497 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,14 +6,14 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/03/24 23:52:56 by ariard ### ########.fr # +# Updated: 2017/03/25 20:15:36 by jhalford ### ########.fr # # # # **************************************************************************** # NAME = 42sh CC = gcc -FLAGS = -Wall -Wextra -Werror -fsanitize=address#-fvisibility=hidden +FLAGS = -Wall -Wextra -Werror D_FLAGS = -g DELTA = $$(echo "$$(tput cols)-47"|bc) diff --git a/42sh/src/history/add_str_in_history.c b/42sh/src/history/add_str_in_history.c index 6340ed5b..0ccfaff2 100644 --- a/42sh/src/history/add_str_in_history.c +++ b/42sh/src/history/add_str_in_history.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/14 11:27:03 by gwojda #+# #+# */ -/* Updated: 2017/03/23 11:30:30 by gwojda ### ########.fr */ +/* Updated: 2017/03/25 20:26:01 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,9 +21,9 @@ void ft_add_in_history_file(char *str) char **hist; i = 0; - hist = ft_strsplit(str, '\n'); if (!(home = ft_getenv(data_singleton()->env, "HOME"))) return ; + hist = ft_strsplit(str, '\n'); path = ft_str3join(home, "/", ".42sh_history"); fd = open(path, O_CREAT | O_WRONLY | O_APPEND, S_IWUSR | S_IRUSR); if (fd > 0) @@ -43,10 +43,10 @@ void ft_add_in_history_file(char *str) void ft_add_str_in_history(char *str) { if (str && *str && (!data_singleton()->line.list_beg || - ft_strcmp(data_singleton()->line.list_beg->prev->str, str))) + ft_strcmp(data_singleton()->line.list_beg->prev->str, str))) { ft_push_back_history(&data_singleton()->line.list_beg, - ft_create_history_list(str)); + ft_create_history_list(str)); ft_add_in_history_file(str); } }