MiniDevil
As beautiful as a shell
Initializes env list from envp array. More...
Include dependency graph for env_init.c:Initializes env list from envp array.
Definition in file env_init.c.
Functions | |
| t_env * | init_env (char **envp) |
| Initialize the environment linked list from main()'s envp. More... | |
| static int | set_env_key_value (t_env *node, char *env_string, char *equal_pos) |
| Parse KEY=value and fill a pre allocated t_env node. More... | |
| t_env * | create_env_node (char *env_string) |
| Create a single environment node from a KEY=value string. More... | |
| void | add_env_node (t_env **head, t_env *new_node) |
| Add a node to the end of the environment linked list. More... | |
| t_env* init_env | ( | char ** | envp | ) |
Initialize the environment linked list from main()'s envp.
| envp | NULL terminated string array from main() |
Definition at line 27 of file env_init.c.
References add_env_node(), create_env_node(), ensure_pwd(), free_env_list(), and handle_shlvl().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Parse KEY=value and fill a pre allocated t_env node.
| node | Pre allocated node to populate |
| env_string | Original KEY=value string |
| equal_pos | Pointer to the = char within env_string |
Definition at line 65 of file env_init.c.
References t_env::key, and t_env::value.
Referenced by create_env_node().
Here is the caller graph for this function:| t_env* create_env_node | ( | char * | env_string | ) |
Create a single environment node from a KEY=value string.
Allocate a t_env_node and populate key/value by splitting at the =
= are rejected (return NULL)| env_string | KEY=value string |
Definition at line 91 of file env_init.c.
References t_env::next, t_env::prev, and set_env_key_value().
Referenced by create_new_var(), and init_env().
Here is the call graph for this function:
Here is the caller graph for this function:Add a node to the end of the environment linked list.
| head | Pointer to list head pointer |
| new_node | Node to add |
Definition at line 121 of file env_init.c.
References t_env::next, and t_env::prev.
Referenced by create_new_var(), export_no_value(), and init_env().
Here is the caller graph for this function: