/* ************************************************************************** */ /* */ /* :::::::: */ /* ft_load_history.c :+: :+: */ /* +:+ */ /* By: whaffman +#+ */ /* +#+ */ /* Created: 2025/02/05 16:44:51 by whaffman #+# #+# */ /* Updated: 2025/02/05 17:11:59 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ #include "minishell.h" void ft_load_history(void) { int fd; char *line; fd = open(".minishell_history", O_RDONLY); if (fd < 0) return ; while (TRUE) { line = get_next_line(fd); if (!line) return ; line[ft_strlen(line) - 1] = '\0'; if (*line) add_history(line); free(line); } close(fd); }