From 9b1ddf7b3491f26d8b3ba9daeca7174aede9c781 Mon Sep 17 00:00:00 2001 From: Christopher Uhlig Date: Tue, 17 Sep 2024 16:34:57 +0200 Subject: [PATCH] added remove for env list --- src/builtins_part_one.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/builtins_part_one.c b/src/builtins_part_one.c index 42561e9..5a35236 100644 --- a/src/builtins_part_one.c +++ b/src/builtins_part_one.c @@ -6,7 +6,7 @@ /* By: chuhlig +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/09 17:01:16 by chuhlig #+# #+# */ -/* Updated: 2024/09/13 21:46:08 by chuhlig ### ########.fr */ +/* Updated: 2024/09/17 16:23:15 by chuhlig ### ########.fr */ /* */ /* ************************************************************************** */ @@ -155,7 +155,7 @@ int exit(char *av) //export -int export(char **av, t_env **env) // here also need to do the same again for envstrarr. dont like it +int export(char **av, t_env **env) { char *tmp; t_env *current; @@ -195,7 +195,7 @@ int export(char **av, t_env **env) // here also need to do the same again for en //unset //for unset as well check and for name part -int unset(char **av, t_env **env) // here also need to do the same again for envstrarr. dont like it +int unset(char **av, t_env **env) { t_env *current; t_env *prev; @@ -243,6 +243,24 @@ void getenvlst(t_env **env, char **en)// seperated name and value return (0); } + +void free_envlst(t_env **env) +{ + t_env *cur; + t_env *new; + + cur = *env; + while (cur) + { + new = cur->next; + free(cur->name); + free(cur->value); + free(cur); + cur = new; + } + +} + // void getenvlststr(t_env **env, char **en)//without serparation // { // int i; -- 2.47.2