mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
simple_cmd: actually contain words
This commit is contained in:
parent
49d7a2b9ff
commit
a50b2f6d74
3 changed files with 29 additions and 7 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/21 12:30:07 by khais #+# #+# */
|
||||
/* Updated: 2025/02/21 12:36:08 by khais ### ########.fr */
|
||||
/* Updated: 2025/02/21 12:51:07 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,15 +14,25 @@
|
|||
#include "libft.h"
|
||||
|
||||
/*
|
||||
** parse a wordlist and yield a simple command
|
||||
** parse a wordlist and yield a simple command.
|
||||
**
|
||||
** takes ownership of words
|
||||
*/
|
||||
t_simple_cmd *simple_cmd_from_wordlist(t_wordlist *words)
|
||||
{
|
||||
(void)words;
|
||||
return (ft_calloc(1, sizeof(t_simple_cmd)));
|
||||
t_simple_cmd *cmd;
|
||||
|
||||
cmd = ft_calloc(1, sizeof(t_simple_cmd));
|
||||
if (cmd == NULL)
|
||||
return (NULL);
|
||||
cmd->words = words;
|
||||
return (cmd);
|
||||
}
|
||||
|
||||
void simple_cmd_destroy(t_simple_cmd *cmd)
|
||||
{
|
||||
if (cmd == NULL)
|
||||
return ;
|
||||
wordlist_destroy(cmd->words);
|
||||
free(cmd);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue