splited execution into multiple files and normed everything
This commit is contained in:
37
srcs/utils.c
Normal file
37
srcs/utils.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/05 18:19:26 by marde-vr #+# #+# */
|
||||
/* Updated: 2024/03/05 18:19:32 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
void free_msh(t_msh *msh)
|
||||
{
|
||||
if (msh)
|
||||
{
|
||||
if (msh->cmds)
|
||||
free_cmd(msh->cmds);
|
||||
if (msh->env)
|
||||
free_env(msh->env);
|
||||
if (msh->aliases)
|
||||
free_alias(msh->aliases);
|
||||
if (msh->pids)
|
||||
free(msh->pids);
|
||||
if (msh->fds)
|
||||
free(msh->fds);
|
||||
free(msh);
|
||||
}
|
||||
}
|
||||
|
||||
void ft_exit(t_msh *msh, int exit_code)
|
||||
{
|
||||
free_msh(msh);
|
||||
exit(exit_code);
|
||||
}
|
Reference in New Issue
Block a user