Commit b4afa439 authored by komask's avatar komask
Browse files

rename launch_exit

parent 60f878b2
......@@ -19,7 +19,7 @@ int ft_cd(char **args, t_xe *xe);
int ft_export(char **args, t_xe *xe);
int ft_unset(char **args, t_xe *xe);
int ft_env(char **args, t_xe *xe);
int launch_exit(char **args, t_xe *xe);
int ft_exit(char **args, t_xe *xe);
/*
** utils
......
......@@ -40,8 +40,7 @@ enum e_retcode
};
int clean_and_exit(int ret, t_xe *xe);
void putstr_stderr(const char *str);
int ft_error(int ret, t_xe *xe);
int ft_exit(enum e_retcode ret, t_xe *xe);
int error_and_exit(enum e_retcode ret, t_xe *xe);
#endif
#include "builtins.h"
int launch_exit(char **args, t_xe *xe)
int ft_exit(char **args, t_xe *xe)
{
if (args != NULL) // necessaire?
{
......
......@@ -233,7 +233,7 @@ int execute_cmd(char **args, char **redir_paths, enum e_redir_op *redir_types,
enum e_cmd_code cmd_code;
const t_exec command[8] = {ft_echo, ft_cd, ft_pwd,
ft_export, ft_unset, ft_env,
launch_exit, launch_ext};
ft_exit, launch_ext};
i = 0;
if (redir_paths != NULL)
......
......@@ -114,7 +114,7 @@ int ft_error(int ret, t_xe *xe)
return (SUCCESS);
}
int ft_exit(enum e_retcode ret, t_xe *xe)
int error_and_exit(enum e_retcode ret, t_xe *xe)
{
ft_error(ret, xe);
return (clean_and_exit(ret, xe));
......
......@@ -111,7 +111,7 @@ int main(int argc, char **argv, char **env_source)
ret = SUCCESS;
xe = (t_xe *)malloc(sizeof(t_xe));
if (xe == NULL)
return (ft_exit(MALLOC_ERR, xe));
return (error_and_exit(MALLOC_ERR, xe));
ft_bzero(xe, sizeof(t_xe));
if (argc > 2)
ret = ARG_ERR;
......@@ -121,7 +121,7 @@ int main(int argc, char **argv, char **env_source)
ret = exec_env_init(xe, env_source);
ret = read_from_file(xe, argv[1]);
if (ret != SUCCESS) // needed?
return (ft_exit(ret, xe)); // needed?
return (error_and_exit(ret, xe)); // needed?
while (ret == SUCCESS)
ret = main_loop(xe);
}
......@@ -130,9 +130,9 @@ int main(int argc, char **argv, char **env_source)
signal_handler(); // err?
ret = exec_env_init(xe, env_source);
if (ret != SUCCESS) // needed?
return (ft_exit(ret, xe)); // needed?
return (error_and_exit(ret, xe)); // needed?
while (ret != CLEAN_EXIT && ret != FAILURE && ret != CHILD_EXIT && ret != FT_EXIT) // why not while (ret == SUCCESS) ?
ret = main_loop(xe);
}
return (ft_exit(ret, xe));
return (error_and_exit(ret, xe));
}
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