34 if (ft_strncmp(current->
key, key, ft_strlen(key) + 1) == 0)
36 current = current->
next;
38 new_node = ft_calloc(1,
sizeof(
t_env));
41 new_node->
key = ft_strdup(key);
42 new_node->
value = NULL;
61 equal_pos = ft_strchr(arg,
'=');
62 key = ft_substr(arg, 0, equal_pos - arg);
65 value = ft_strdup(equal_pos + 1);
110 plus_pos = ft_strnstr(arg,
"+=", ft_strlen(arg));
111 key = ft_substr(arg, 0, plus_pos - arg);
Shell builtin commands prototypes.
Environment variable management prototypes.
void add_env_node(t_env **head, t_env *new_node)
Add a node to the end of the environment linked 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.
char * append_str(char *s1, char *s2)
Concatenates 2 strings and frees the first.
void export_no_value(t_env **env, char *key)
Export a variable with no value (export KEY)
void export_assign(t_env **env, char *arg)
Export a variable with a value (export KEY=value)
static char * get_append_value(t_env *env, char *key, char *append_str)
Build the new value for an append operation.
void export_append(t_env **env, char *arg)
Export a variable with append (export KEY+=value)
Environment variable (doubly linked list)
char * value
Value (NULL if export only)
struct s_env * next
Next node.