moved env functions to libft
This commit is contained in:
32
libft/srcs/ft_envclean.c
Normal file
32
libft/srcs/ft_envclean.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_envclean.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/12/06 09:53:25 by tmaze #+# #+# */
|
||||
/* Updated: 2019/12/06 09:53:47 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_envclean(t_env **env)
|
||||
{
|
||||
t_env **it;
|
||||
t_env *tmp;
|
||||
|
||||
it = env;
|
||||
while (*it)
|
||||
{
|
||||
if (ft_strequ((*it)->val, ""))
|
||||
{
|
||||
tmp = *it;
|
||||
*it = tmp->next;
|
||||
ft_envdelelem(&tmp);
|
||||
}
|
||||
else
|
||||
it = &((*it)->next);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user