This commit is contained in:
Tom Moron
2024-02-09 16:43:35 +01:00
parent 22403b127e
commit ce72dde43e
12 changed files with 242 additions and 244 deletions

View File

@ -6,26 +6,30 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/07 16:04:11 by tomoron #+# #+# */
/* Updated: 2024/02/07 16:48:07 by tomoron ### ########.fr */
/* Updated: 2024/02/09 15:08:01 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void ft_exit(t_cmd *args)
void ft_exit(t_cmd *args, t_env *env)
{
t_cmd *start;
t_cmd *start;
int exit_code;
start = args;
args = args->next;
ft_printf("exit\n");
if(args && args->next)
if (args && args->next)
ft_printf("minishell: exit: too many arguments\n");
else
{
if (args)
exit_code = (unsigned char)ft_atoi(args->token);
else
exit_code = g_return_code;
ft_free_cmd(start);
if(args)
exit((unsigned char)ft_atoi(args->token));
ft_free_env(env);
exit(g_return_code);
}
}