Commit 69e54136 authored by abenoit's avatar abenoit
Browse files

EXIT_ARG_ERR resets RUN flags

parent 6f433342
builtins: set stat_loc for all returns
========> MALLOC_ERR and WRITE_ERR status return ?
./filethatdoesexistbutnotexecutable
echo $?
./filethatdoesntexist
echo $?
..
echo $?
arthur:
comportement simplifié ^D
......
......@@ -20,8 +20,6 @@ int ft_exit(char **args, t_xe *xe)
if (args[2] != NULL)
{
xe->stat_loc = 1;
if (!(xe->flags & RUN))
xe->flags += RUN;
return (EXIT_ARG_ERR);
}
xe->stat_loc = (unsigned int)ft_atoi(args[1]) % 256;
......
......@@ -36,6 +36,8 @@ int exec_error(int err_code, t_xe *xe)
// have to set stat_loc as well !!!
if (err_code == NO_SUCH_FILE)
xe->stat_loc = 127;
if (err_code == EXIT_ARG_ERR)
xe->flags = RUN;
if (xe->flags & EXEC_PIPE)
xe->flags -= RUN;
return (SUCCESS);
......@@ -110,11 +112,11 @@ int ft_error(int ret, t_xe *xe)
{
if (xe->flags & EXIT_FLAG) // temp pour le testeur
{
//if (!(xe->flags & CHILD))
// {
if (!(xe->flags & CHILD))
{
if (ft_putstr_fd("exit\n", STDOUT_FILENO) != WRITE_SUCCESS)
return (WRITE_ERR); // possible?
// }
}
}
if (ret == PIPE_EXIT)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment