/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_envupdate.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/12/05 19:10:38 by tmaze #+# #+# */ /* Updated: 2019/12/05 19:10:52 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_envupdate(char *key, t_env *env, char *val) { t_env *elem; char *new; new = NULL; if ((elem = ft_envgetelem(key, env)) != NULL) if ((new = ft_strdup(val)) != NULL) { ft_strdel(&elem->val); elem->val = new; } return (new); }