Exemple #1
0
int			do_history(t_shell *sh, char **cmd)
{
	int		fd;

	if ((fd = open_history()) == -1)
		return (1);
	if (do_history_bis(sh, cmd, fd) == 1)
		return (1);
	close(fd);
	return (0);
}
Exemple #2
0
static void		ft_clean_history(int histo_fd)
{
	t_histo			*histo;

	histo = save_history(NULL, 0);
	if (histo_fd > 0)
	{
		close(histo_fd);
		unlink(histo->path_cmd);
	}
	if (histo != NULL)
	{
		free_histo();
		if (histo->path_cmd != NULL)
			free(histo->path_cmd);
		free(histo);
	}
	open_history();
}