splited execution into multiple files and normed everything

This commit is contained in:
mdev9
2024-03-05 19:30:58 +01:00
parent f000625ab9
commit e19a9a6114
16 changed files with 584 additions and 473 deletions

37
srcs/utils.c Normal file
View 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);
}