45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* cmd.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2023/02/15 14:18:21 by cchauvet #+# #+# */
|
||
|
/* Updated: 2023/02/15 14:18:38 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "minishell.h"
|
||
|
|
||
|
void ft_cmddel(void *ptr)
|
||
|
{
|
||
|
t_cmd *content;
|
||
|
|
||
|
content = (t_cmd *) ptr;
|
||
|
if (content->args != NULL)
|
||
|
ft_freer_tab_ultimate(1, content->args);
|
||
|
if (content->executable != NULL)
|
||
|
free(content->executable);
|
||
|
free(content);
|
||
|
}
|
||
|
|
||
|
int ft_cmd_filler(t_list *element, char **args)
|
||
|
{
|
||
|
t_cmd *content;
|
||
|
size_t i;
|
||
|
|
||
|
if (args == NULL)
|
||
|
return (1);
|
||
|
content = (t_cmd *)element->content;
|
||
|
i = 0;
|
||
|
while (args[i] != NULL)
|
||
|
{
|
||
|
ft_quote_remover(args[i]);
|
||
|
i++;
|
||
|
}
|
||
|
content->args = args;
|
||
|
content->executable = args[0];
|
||
|
return (0);
|
||
|
}
|