mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
cmdgroup parsing: start implementing the new architecture
This commit is contained in:
parent
d6bb24df54
commit
f9aa614ef2
4 changed files with 18 additions and 30 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/11 15:18:02 by khais #+# #+# */
|
||||
/* Updated: 2025/03/11 18:14:24 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/18 11:48:33 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,12 +25,6 @@ t_cmdgroup *cmdgroup_from_wordlist(t_wordlist *words)
|
|||
cmd = ft_calloc(1, sizeof(t_cmdgroup));
|
||||
if (cmd == NULL)
|
||||
return (NULL);
|
||||
cmd->item_num = 1;
|
||||
cmd->items = ft_calloc(1, sizeof(t_cmdgroup_item));
|
||||
if (cmd->items == NULL)
|
||||
return (free(cmd), NULL);
|
||||
cmd->items[0].type = TYPE_LIST;
|
||||
cmd->items[0].inner.cmdlist = cmdlist_from_wordlist(words);
|
||||
return (cmd);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/11 15:11:57 by khais #+# #+# */
|
||||
/* Updated: 2025/03/11 18:14:33 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/18 12:07:29 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,19 +14,23 @@
|
|||
# define CMDGROUP_H
|
||||
|
||||
# include "../wordlist/wordlist.h"
|
||||
# include "../command_list/command_list.h"
|
||||
|
||||
struct s_cmdgroup_item;
|
||||
|
||||
/*
|
||||
** A grouping of commands, surrounded by parentheses.
|
||||
**
|
||||
** A top-level cmdgroup is modeled as having an implicit set of parentheses.
|
||||
*/
|
||||
typedef struct s_cmdgroup
|
||||
{
|
||||
/*
|
||||
** Number of items in this cmdgroup
|
||||
** list of the commands inside this group
|
||||
*/
|
||||
int item_num;
|
||||
struct s_cmdlist item;
|
||||
/*
|
||||
** array of items in this cmdgroup
|
||||
** redirections to apply to the whole group
|
||||
*/
|
||||
struct s_cmdgroup_item *items;
|
||||
struct s_redirection_list *redirections;
|
||||
} t_cmdgroup;
|
||||
|
||||
t_cmdgroup *cmdgroup_from_wordlist(t_wordlist *words);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue