norm ok
This commit is contained in:
16
ft_exit.c
16
ft_exit.c
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user