minishell/src/main.c
whaffman 91cb0af6ef Free_safe implemented, ft_lstnew_safe and ft_lstclear_safe added
ft_strdup_safe added
ft_strjoin_safe added
2025-02-25 16:55:13 +01:00

44 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* main.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/04 16:19:22 by whaffman #+# #+# */
/* Updated: 2025/02/19 17:59:24 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "minishell.h"
#include "utils.h"
int main(int argc, char **argv, char **envp)
{
t_minishell *minishell;
(void)argc;
(void)argv;
print_banner();
history_load();
minishell = init_minishell();
signal_init_minishell();
environment_parse(minishell, envp);
while (TRUE)
{
minishell->line = ft_prompt(minishell);
if (minishell->line == NULL)
break ;
minishell->lexer = ft_lexer_new(minishell);
minishell->tokens = ft_parse_input(minishell);
//ft_lstiter(minishell->tokens, token_print);
minishell->commands = parser_get_commands(minishell);
simple_builtins(minishell);
free_minishell_line(minishell);
}
ft_lstclear_safe(minishell, &minishell->commands, free_command_list);
free_minishell(&minishell);
return (EXIT_SUCCESS);
}