From: Dominik Kaiser Date: Tue, 14 Jan 2025 17:32:42 +0000 (+0100) Subject: Merge branch 'miau' into uwu X-Git-Url: https://git.dkaiser.de/?a=commitdiff_plain;h=d4f3525a01f2566afed0da9209cb1c64bf188776;p=42%2Fminishell.git Merge branch 'miau' into uwu --- d4f3525a01f2566afed0da9209cb1c64bf188776 diff --cc include/minishell.h index f0f458b,9d586b1..c905ca5 --- a/include/minishell.h +++ b/include/minishell.h @@@ -40,6 -42,6 +42,7 @@@ int eval(t_node *node, t_env **env) char *get_cmd_path(char *cmd, t_env *env); int execute_cmd(t_cmd *cmd, t_env **env); char *format_string(char *str, t_env *env); +int set_return_code(int return_code, t_env **env); + int handle_redirections(t_redirection *redirs); #endif diff --cc src/main.c index 9e5d4ec,8abc4c9..8cebdd1 --- a/src/main.c +++ b/src/main.c @@@ -22,6 -24,7 +24,9 @@@ int main(int argc, char *argv[], char * if (init()) return (1); getenvlst(&env, envp); - set_return_code(0, &env); - repl("Minishell $ ", &env); ++ ++ set_return_code(0, &env); + repl("Minishell $ ", &env, &promptflag); + free_envlst(&env); + return (0); } diff --cc src/repl.c index 4292197,7eb6c0d..5079ee8 --- a/src/repl.c +++ b/src/repl.c @@@ -49,13 -35,9 +35,9 @@@ void repl(const char *prompt, t_env **e add_history(input); token_list = NULL; tokenizer(input, &token_list, '\0'); - token_list = reverse_token_list(token_list); lines = parse(token_list, env); if (lines) - { - print_ast(lines->content); - eval(lines->content, env); + set_return_code(eval(lines->content, env), env); - } free(input); } }