fix msg erreur historique
This commit is contained in:
parent
0967785551
commit
0249416b1d
1 changed files with 10 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 17:34:23 by gwojda #+# #+# */
|
/* 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);
|
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)
|
void ft_init_history(void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
@ -45,10 +51,11 @@ void ft_init_history(void)
|
||||||
if (ft_str_is_print(str) && *str)
|
if (ft_str_is_print(str) && *str)
|
||||||
ft_push_back_history(&data_singleton()->line.list_beg,
|
ft_push_back_history(&data_singleton()->line.list_beg,
|
||||||
ft_create_history_list(str));
|
ft_create_history_list(str));
|
||||||
else if (!corrupt)
|
else
|
||||||
ft_dprintf(2, "42sh: corrupt history file %s/.zsh_history", home);
|
corrupt = CORRUPT;
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
corrupt_history(corrupt, home);
|
||||||
free(path);
|
free(path);
|
||||||
free(str);
|
free(str);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue