32 if (ft_strncmp(current->
key, key, ft_strlen(key) + 1) == 0)
33 return (current->
value);
34 current = current->
next;
58 if (ft_strncmp(current->
key, key, ft_strlen(key) + 1) == 0)
60 new_value = ft_strdup(value);
64 current->
value = new_value;
67 current = current->
next;
89 tmp = ft_strjoin(key,
"=");
92 env_string = ft_strjoin(tmp, value);
Environment variable management prototypes.
t_env * create_env_node(char *env_string)
Create a single environment node from a KEY=value string.
void add_env_node(t_env **head, t_env *new_node)
Add a node to the end of the environment linked list.
static int update_existing_var(t_env *env_list, char *key, char *value)
Update the value of an existing environment variable.
static int create_new_var(t_env **env_list, char *key, char *value)
Create a new variable and add it to the list.
int set_env_value(t_env **env_list, char *key, char *value)
Set or create an environment variable.
char * get_env_value(t_env *env_list, char *key)
Look up an environment variable's value by its key.
Environment variable (doubly linked list)
char * value
Value (NULL if export only)
struct s_env * next
Next node.