This commit is contained in:
Jack Halford 2017-03-25 20:26:29 +01:00
parent 432e2b8e6f
commit c19ee394f0
2 changed files with 6 additions and 6 deletions

View file

@ -6,14 +6,14 @@
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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)

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}
}