free_exit() renamed exit_free()

This commit is contained in:
LuckyLaszlo
2021-11-29 12:44:46 +01:00
parent 33f4878f36
commit b265e8475a
8 changed files with 16 additions and 16 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
/* Updated: 2021/11/29 12:25:28 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:15 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -65,7 +65,7 @@ int builtin_echo(int argc, char *argv[], t_all *c);
int getenv_position(char **envp, char *name);
// Free
int free_exit(t_all *c, int exit_status);
int exit_free(t_all *c, int exit_status);
void free_pipeline(t_cmd **pipeline_ptr[]);
void close_pipeline_fd(t_cmd *pipeline[]);
typedef void (*t_free_f)(void *); // generic

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/10 05:01:22 by lperrey #+# #+# */
/* Updated: 2021/11/27 10:47:32 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:47 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -38,5 +38,5 @@ int builtin_exit(int argc, char *argv[], t_all *c) // WIP
}
status = ft_atoi(argv[1]);
}
return (free_exit(c, status));
return (exit_free(c, status));
}

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
/* Updated: 2021/11/29 12:26:27 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:52 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -83,7 +83,7 @@ static pid_t pipeline_exec(t_cmd *pipeline[], t_all *c)
{
ret = cmd_exec_in_subshell(pipeline[i], c);
if (ret != EXIT_SUCCESS)
free_exit(c, ret);
exit_free(c, ret);
}
i++;
}

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
/* Updated: 2021/11/29 12:26:33 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:55 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -29,7 +29,7 @@ int cmd_exec_in_subshell(t_cmd *cmd, t_all *c)
return (ft_reti_perror(EXIT_FAILURE, "dup2()"));
close_pipeline_fd(c->pipeline);
if (cmd->builtin_func)
free_exit(c, cmd->builtin_func(ft_2d_arrlen(cmd->argv), cmd->argv, c));
exit_free(c, cmd->builtin_func(ft_2d_arrlen(cmd->argv), cmd->argv, c));
else if (execve(cmd->path, cmd->argv, environ) == -1)
return (ft_reti_perror_io(EXIT_FAILURE, "execve() ", cmd->argv[0]));
}

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/10 23:53:17 by lperrey #+# #+# */
/* Updated: 2021/11/29 12:25:46 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:29 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -31,7 +31,7 @@ void ft_free_2d_arr_ENVIRON(void *ptr)
free(arr);
}
int free_exit(t_all *c, int exit_status)
int exit_free(t_all *c, int exit_status)
{
free(c->prompt_base);
free(c->prompt);

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */
/* Updated: 2021/11/27 11:19:15 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:34 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
(void)argc;
(void)argv;
if (!init(&c))
free_exit(&c, EXIT_FAILURE);
exit_free(&c, EXIT_FAILURE);
//putenv("VAR=W1 W2 W3"); // TEMP TEST
// if (argv[1] || !isatty(STDIN_FILENO))
// shell_script(&c);

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */
/* Updated: 2021/11/29 12:25:59 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:38 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -46,7 +46,7 @@ void shell_loop(t_all *c)
else if (!line_input)
{
write(1, "exit\n", 5);
free_exit(c, get_last_exit_status());
exit_free(c, get_last_exit_status());
}
}
}

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/26 23:47:44 by lperrey #+# #+# */
/* Updated: 2021/10/30 15:01:13 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:43:44 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,5 +15,5 @@
void shell_script(t_all *c) // WIP
{
ft_putstr_fd("Shell Script Placeholder\n", 1);
free_exit(c, EXIT_SUCCESS);
exit_free(c, EXIT_SUCCESS);
}