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

Functions used to make sure that the array storing execution commands, stores them correctly after expansion. More...

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

Functions

char ** combine_execs (char **resplit, char **new_execs, char **execs)
 Combine resplit array with execs array into new_execs array.
 
int after_expand (t_executor *current)
 Process the execs array of the current executor node after expansion.
 
bool check_execs_after_expand (t_shell *shell)
 Checks and processes execution commands after expansion.
 

Detailed Description

Functions used to make sure that the array storing execution commands, stores them correctly after expansion.

Functions used to make sure that the array storing execution commands, stores them correctly after expansion.

Function Documentation

◆ after_expand()

int after_expand ( t_executor current)

Process the execs array of the current executor node after expansion.

Takes a node of the executor list, splits its execs array (execution command) and combines the resulting strings with the existing execs array.

Parameters
[in,out]currentThe current executor node.
Returns
The result of the process (OK, NOT_FOUND, or FAILED).

◆ check_execs_after_expand()

bool check_execs_after_expand ( t_shell shell)

Checks and processes execution commands after expansion.

Iterates through the executor list ands calls after_expand() on each of the nodes of that list. Retuns true if all processing is successfull, or false if any processing fails.

Parameters
[in,out]shellThe main data structure.
Returns
True if all processing succeeds, false if any processing fails.

◆ combine_execs()

char ** combine_execs ( char **  resplit,
char **  new_execs,
char **  execs 
)

Combine resplit array with execs array into new_execs array.

Takes 2 arrays of strings, 'resplit' and 'execs', combines them into a new array 'new_execs'. Also frees the memory of the input arrays.

Warning
The memory for new_execs is allocated outside of the function.
Parameters
[in]resplitThe first array of strings.
[in,out]new_execsThe resulting array of strings after combining.
[in]execsThe second array of strings.
Returns
new_execs The combined array of strings.