/* ************************************************************************** */ /* */ /* :::::::: */ /* environment_del.c :+: :+: */ /* +:+ */ /* By: whaffman +#+ */ /* +#+ */ /* Created: 2025/02/11 14:17:53 by whaffman #+# #+# */ /* Updated: 2025/02/11 15:40:09 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ #include "minishell.h" void environment_del(t_list **environment, char *name) { t_list *prev; t_list *current; t_list *next; t_environment *env; prev = NULL; next = NULL; current = *environment; while (current != NULL) { env = (t_environment *)current->content; if (ft_strncmp(env->name, name, ft_strlen(name) + 1) == 0) { next = current->next; environment_free(current->content); free(current); if (prev == NULL) *environment = next; else prev->next = next; return ; } prev = current; current = current->next; } }