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

Interpolation of variables and handling of quotes. More...

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

Functions

char * interpolate (t_shell *shell, char *str)
 Interpolates variables and handles quotes within a shell command.
 

Detailed Description

Interpolation of variables and handling of quotes.

This file contains functions related to variable interpolation and the handling of quoted strings. Variable interpolation involves replacing variable references (e.g., $VAR) with their corresponding values from the environment list. Quotes can be single (' ') or double (" ") and may contain variable expansions.

Function Documentation

◆ interpolate()

char * interpolate ( t_shell shell,
char *  str 
)

Interpolates variables and handles quotes within a shell command.

This function processes variable interpolation and handles quotes (single or double) within the shell prompt. It iterates through the prompt string, expanding variables and preserving quoted strings.

Parameters
[in]shellA pointer to the shell struct.
[in,out]strA pointer to the command string to be processed.
[in]interA pointer to the expander struct.
Returns
A dynamically allocated string containing the processed contents or NULL on failure.