-
Notifications
You must be signed in to change notification settings - Fork 0
/
min_exit.c
34 lines (32 loc) · 1.28 KB
/
min_exit.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* min_exit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: potero-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/04 12:31:15 by potero-d #+# #+# */
/* Updated: 2022/08/04 12:33:46 by potero-d ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void min_exit(t_argv *arg, t_data *data)
{
if (ft_strcmp(arg->split[0], "exit") == 0)
{
if (arg->split[1])
{
if (ft_atoi(arg->split[1]))
{
data->error_no = ft_atoi(arg->split[1]);
update_error(data);
exit (ft_atoi(arg->split[1]));
}
else
printf("Minishell: exit: %s: numeric argument required",
arg->split[1]);
}
printf("exit\n");
exit (0);
}
}