diff --git a/builtins/unset.c b/builtins/unset.c new file mode 100644 index 0000000..1de43be --- /dev/null +++ b/builtins/unset.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* unset.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: erey-bet +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/02/22 13:28:27 by erey-bet #+# #+# */ +/* Updated: 2023/02/22 13:37:27 by erey-bet ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int unset(t_list **env, char **args, int fd) +{ + while (args++) + delete_by_key(*args, env); + return (0); +} diff --git a/env3.c b/env3.c index 42b357e..bca6060 100644 --- a/env3.c +++ b/env3.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/17 17:25:09 by erey-bet #+# #+# */ -/* Updated: 2023/02/22 01:41:04 by erey-bet ### ########.fr */ +/* Updated: 2023/02/22 13:28:51 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -76,9 +76,10 @@ int delete_by_key(char *key, t_list **head) last->next = current->next; else *head = current->next; + return (1); } last = current; current = current->next; } - return (1); + return (0); }