Compare commits

...

13 Commits

Author SHA1 Message Date
Camille Chauvet
e7f8373b4a c la merde 2023-02-28 15:21:47 +01:00
Camille Chauvet
9cbb1e139a Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:57:25 +01:00
Camille Chauvet
06f6308bc4 merge 2023-02-28 14:57:16 +01:00
Camille Chauvet
b2c7013cf9 Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:55:18 +01:00
Camille Chauvet
7f4fd9d421 Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:54:15 +01:00
Camille Chauvet
af7336fbf3 Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:52:16 +01:00
Camille Chauvet
4342d9a015 Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:41:28 +01:00
Camille Chauvet
e0e329a355 Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:36:36 +01:00
Camille Chauvet
5541a1f3fe Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:29:22 +01:00
Camille Chauvet
b914753c47 Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 14:25:41 +01:00
Camille Chauvet
9a5cca3e2d Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 13:20:25 +01:00
Camille Chauvet
77620211da Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-28 13:17:31 +01:00
Camille Chauvet
07bc37cc71 fix 2023-02-28 13:17:26 +01:00
3 changed files with 13 additions and 8 deletions

4
cmd.c
View File

@ -23,8 +23,8 @@ void ft_cmddel(void *ptr)
if (content->executable != NULL)
free(content->executable);
if (content->fd_in > 2)
close(content->fd_out);
if (content->fd_in > 2)
close(content->fd_in);
if (content->fd_out > 2)
close(content->fd_out);
free(content);
}

View File

@ -118,17 +118,21 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd)
else if (ft_strcmp(cmd->executable, "exit") == 0)
{
exit_code = ft_exit(cmd->args + 1);
if (exit_code != -1)
if (exit_code > -1)
{
data->exit_code = exit_code;
return_code = -2;
}
else
{
data->exit_code = 1;
return_code = -3;
}
}
if (return_code != -1)
{
cmd->executable = NULL;
if (return_code >= 0)
data->exit_code = return_code;
}
if (return_code != -1)
cmd->executable = NULL;
return (return_code);
}

View File

@ -38,7 +38,8 @@ static char *ft_spacer_after(const char *str)
if (out == NULL)
return (NULL);
}
i++;
if (out[i] != '\0')
i++;
}
return (out);
}