maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
loc_env_var_handler_utils_utils_utils_utils.c File Reference
#include "tokens.h"
Include dependency graph for loc_env_var_handler_utils_utils_utils_utils.c:

Go to the source code of this file.

Functions

char ** initialize_result_array (int *count)
 
int toggle_quotes (int in_quotes, char current_char)
 
char ** add_segment_on_delimiter (char **result, char **start, char *str, int *count)
 
char ** finalize_result_array (char **result, int count)
 

Function Documentation

◆ add_segment_on_delimiter()

char ** add_segment_on_delimiter ( char **  result,
char **  start,
char *  str,
int *  count 
)

Definition at line 33 of file loc_env_var_handler_utils_utils_utils_utils.c.

35{
36 result = ft_add_segment(result, *start, str - *start, count);
37 *start = str + 1;
38 return (result);
39}
char ** ft_add_segment(char **result, char *start, size_t length, int *count)

References ft_add_segment().

Referenced by ft_split_preserve_quotes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize_result_array()

char ** finalize_result_array ( char **  result,
int  count 
)

Definition at line 41 of file loc_env_var_handler_utils_utils_utils_utils.c.

42{
43 char **temp;
44
45 temp = realloc(result, sizeof(char *) * (count + 1));
46 if (!temp)
47 {
48 free(result);
49 return (NULL);
50 }
51 result = temp;
52 result[count] = NULL;
53 return (result);
54}

Referenced by ft_split_preserve_quotes().

Here is the caller graph for this function:

◆ initialize_result_array()

char ** initialize_result_array ( int *  count)

Definition at line 15 of file loc_env_var_handler_utils_utils_utils_utils.c.

16{
17 char **result;
18
19 *count = 0;
20 result = malloc(sizeof(char *));
21 if (!result)
22 return (NULL);
23 return (result);
24}

Referenced by ft_split_preserve_quotes().

Here is the caller graph for this function:

◆ toggle_quotes()

int toggle_quotes ( int  in_quotes,
char  current_char 
)

Definition at line 26 of file loc_env_var_handler_utils_utils_utils_utils.c.

27{
28 if (current_char == '"' || current_char == '\'')
29 return (!in_quotes);
30 return (in_quotes);
31}

Referenced by ft_split_preserve_quotes().

Here is the caller graph for this function: