Bozo3 avance

This commit is contained in:
Etienne Rey-bethbeder 2023-02-22 14:00:09 +01:00
parent cdde24f0d0
commit 29a4a864c3
2 changed files with 21 additions and 2 deletions

18
builtins/unset.c Normal file
View File

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* unset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}

5
env3.c
View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}