minishell
Minishell Project for École 42
All Classes Files Functions Typedefs Enumerations Pages
expander.c File Reference

Variable expansion. More...

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

Functions

int expand_var (t_shell *shell, char **str, t_expander *exp, int pos)
 Expand variables.
 
bool expander (t_shell *shell)
 Starting point of variable expansion.
 

Detailed Description

Variable expansion.

Function Documentation

◆ expand_var()

int expand_var ( t_shell shell,
char **  str,
t_expander exp,
int  pos 
)

Expand variables.

This function is expanding variables. It iterates through the command string, identifies variables and replaces them with the corresponding values.

Parameters
[in]shellA pointer to the shell struct.
[in,out]strA pointer to the command string.
[in,out]expA pointer to the expander struct.
[in]posThe current position in the result string.
Returns
The updated position in the result string after expansion.

◆ expander()

bool expander ( t_shell shell)

Starting point of variable expansion.

This function is the starting point for expanding variables.It iterates through each command and applies variable expansion if needed or just copies from the input.

Parameters
[in,out]shellA pointer to the shell struct.