Bozo3 avance
This commit is contained in:
parent
cdde24f0d0
commit
29a4a864c3
18
builtins/unset.c
Normal file
18
builtins/unset.c
Normal 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
5
env3.c
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/17 17:25:09 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;
|
last->next = current->next;
|
||||||
else
|
else
|
||||||
*head = current->next;
|
*head = current->next;
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
last = current;
|
last = current;
|
||||||
current = current->next;
|
current = current->next;
|
||||||
}
|
}
|
||||||
return (1);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user