MiniDevil
As beautiful as a shell
Converts env linked list to envp array. More...
Include dependency graph for env_conversion.c:Converts env linked list to envp array.
Definition in file env_conversion.c.
Functions | |
| static char * | create_env_string (t_env *node) |
| Convert an env node to a "KEY=value" string. More... | |
| static void | free_incomplete_array (char **arr, int count) |
| Free a partially filled array. More... | |
| static int | fill_env_array (char **arr, t_env *env, int size) |
| Fill an array with KEY=value strings. More... | |
| char ** | env_to_array (t_env *env) |
| Convert the env linked list to a NULL terminated string array. More... | |
|
static |
Convert an env node to a "KEY=value" string.
Joins node->key + = + node->value. If value is NULL, the result is KEY= with no value
| node | Environment node to convert |
Definition at line 25 of file env_conversion.c.
References t_env::key, and t_env::value.
Referenced by fill_env_array().
Here is the caller graph for this function:
|
static |
Free a partially filled array.
Used for cleanup when fill_env_array() fails in the middle
| arr | Array to free |
| count | Number of entries to free |
Definition at line 51 of file env_conversion.c.
Referenced by fill_env_array().
Here is the caller graph for this function:
|
static |
Fill an array with KEY=value strings.
Iterate through the env list while converting each node to a string
| arr | Pre allocated array of size + 1 pointers |
| env | List head |
| size | Number of nodes to convert |
Definition at line 76 of file env_conversion.c.
References create_env_string(), free_incomplete_array(), and t_env::next.
Referenced by env_to_array().
Here is the call graph for this function:
Here is the caller graph for this function:| char** env_to_array | ( | t_env * | env | ) |
Convert the env linked list to a NULL terminated string array.
Builds a char** destined to execve(). Each entry is in a KEY=value string
| env | List head |
Definition at line 107 of file env_conversion.c.
References env_list_size(), and fill_env_array().
Referenced by prepare_exec().
Here is the call graph for this function:
Here is the caller graph for this function: