fix msg erreur historique

This commit is contained in:
gwojda 2017-03-17 16:04:21 +01:00
parent 0967785551
commit 0249416b1d

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 17:34:23 by gwojda #+# #+# */
/* Updated: 2017/03/17 14:35:12 by gwojda ### ########.fr */
/* Updated: 2017/03/17 16:01:44 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -26,6 +26,12 @@ static int ft_str_is_print(char *str)
return (1);
}
static void corrupt_history(int corrupt, char *home)
{
if (corrupt)
ft_dprintf(2, "42sh: corrupt history file %s/.zsh_history\n", home);
}
void ft_init_history(void)
{
int fd;
@ -45,10 +51,11 @@ void ft_init_history(void)
if (ft_str_is_print(str) && *str)
ft_push_back_history(&data_singleton()->line.list_beg,
ft_create_history_list(str));
else if (!corrupt)
ft_dprintf(2, "42sh: corrupt history file %s/.zsh_history", home);
else
corrupt = CORRUPT;
free(str);
}
corrupt_history(corrupt, home);
free(path);
free(str);
close(fd);