This commit is contained in:
Tom Moron
2024-02-09 16:43:35 +01:00
parent 22403b127e
commit ce72dde43e
12 changed files with 242 additions and 244 deletions

View File

@ -6,16 +6,16 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/06 20:46:19 by tomoron #+# #+# */
/* Updated: 2024/02/08 12:42:12 by tomoron ### ########.fr */
/* Updated: 2024/02/09 15:09:02 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
t_cmd *ft_cmd_add_back(t_cmd *cmd, char *token)
t_cmd *ft_cmd_add_back(t_cmd *cmd, char *token)
{
t_cmd *res;
t_cmd *current;
t_cmd *res;
t_cmd *current;
res = ft_calloc(1, sizeof(t_cmd));
if (!res)
@ -26,15 +26,15 @@ t_cmd *ft_cmd_add_back(t_cmd *cmd, char *token)
current = cmd;
while (current->next)
current = current->next;
current->next = res;
current->next = res;
return (cmd);
}
void ft_free_cmd(t_cmd *cmd)
{
if(cmd && cmd->next)
if (cmd && cmd->next)
ft_free_cmd(cmd->next);
if(cmd)
if (cmd)
free(cmd->token);
free(cmd);
}