minishell
Minishell Project for École 42
Loading...
Searching...
No Matches
fill_executor_list.c File Reference

Functions for filling the t_executor list and processing the t_lexer_list. More...

#include "minishell.h"
Include dependency graph for fill_executor_list.c:

Functions

int process_out_append (t_executor *current, t_lexer_list *lexer)
 Processes output redirections and append for the given node of the executor list.
 
int process_in_heredoc (t_executor *current, t_lexer_list *lexer)
 Processes input redirections and heredoc for the given node of the executor list.
 
int process_command (t_executor *current, t_lexer_list *lexer)
 Processes the command part for the given node of the executor list.
 
t_executorprocess_lexemes (t_executor *list, t_executor *current, t_lexer_list **lexer)
 Processes lexemes and sets values in the given t_executor node.
 
t_executorfill_executor_list (t_shell *shell, t_executor *list)
 Fills the t_executor linked list with info about the parsed commands.
 

Detailed Description

Functions for filling the t_executor list and processing the t_lexer_list.

Function Documentation

◆ fill_executor_list()

t_executor * fill_executor_list ( t_shell shell,
t_executor list 
)

Fills the t_executor linked list with info about the parsed commands.

Fills the t_executor linked list by processing the lexer linked list and setting values in a t_executor node for each command and its operation.

Parameters
shellA pointer to the main data structure.
listA pointer the t_executor linked list to be filled.
Returns
A pointer to the filled t_executor linked list, or NULL on error.

◆ process_command()

int process_command ( t_executor current,
t_lexer_list lexer 
)

Processes the command part for the given node of the executor list.

Handles the command part of the given executor list node by creating an array of command arguments.

Parameters
currentA pointer to the current t_executor node.
lexerA pointer to the current lexer list node.
Returns
OK if successful, FAILED if an error occurs, NOT_FOUND if not applicable.

◆ process_in_heredoc()

int process_in_heredoc ( t_executor current,
t_lexer_list lexer 
)

Processes input redirections and heredoc for the given node of the executor list.

Handles input redirections and heredoc for the given executor list node by calling its subfunctions. Has some edgecase handling.

Parameters
currentA pointer to the current t_executor node.
lexerA pointer to the current lexer list node.
Returns
OK if successful, FAILED if an error occurs, NOT_FOUND if not applicable.

◆ process_lexemes()

t_executor * process_lexemes ( t_executor list,
t_executor current,
t_lexer_list **  lexer 
)

Processes lexemes and sets values in the given t_executor node.

Processes lexemes in the lexer linked list and populates the executor linked list accordingly. It handles output redirections, input redirections inclusive heredoc and command executions. On error, frees the entire t_executor linked list and returns NULL.

Parameters
listA pointer to the t_executor linked list.
currentA pointer to the current t_executor node.
lexerA pointer to the lexer linked list.
Returns
A pointer to the updated t_executor node, or NULL on error.

◆ process_out_append()

int process_out_append ( t_executor current,
t_lexer_list lexer 
)

Processes output redirections and append for the given node of the executor list.

Handles output redirections and append for the given executor list node by calling its subfunctions. Has some edgecase handling.

Parameters
currentA pointer to the current t_executor node.
lexerA pointer to the current lexer list node.
Returns
OK if successful, FAILED if an error occurs, NOT_FOUND if not applicable.