This commit is contained in:
Loic Deridder
2025-01-15 13:41:40 +01:00
parent eedfe4a0ee
commit 0ec78ee34c
11 changed files with 182 additions and 48 deletions

View File

@@ -5,6 +5,8 @@ int ft_isnumeric(char *str)
int i;
i = 0;
if (!str)
return (1);
while (str[i])
{
if (ft_isdigit(str[i]))
@@ -30,8 +32,23 @@ void bash_exit_error(char *arg)
exit(2);
}
void builtin_exit(char *arg, bool depth)
static char *get_arg(char *str)
{
int i;
i = 4;
if (!str[i])
return (NULL);
while (str[i] && str[i] == ' ')
i++;
return (&str[i]);
}
void builtin_exit(char *str, bool depth)
{
char *arg;
arg = get_arg(str);
if (depth == true)
{
if (!ft_isnumeric(arg))