/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* unset.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/22 13:28:27 by erey-bet #+# #+# */ /* Updated: 2023/02/23 15:49:21 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ #include "./builtins_private.h" int error(char *str, int fd) { write(fd, "bash: unset: `", 14); write(fd, str, ft_strlen(str)); write(fd, "': not a valid identifier", 25); return (1); } int unset(t_list **env, char **args, int fd) { int i; int err; i = -1; err = 0; while (args[++i]) if (delete_by_key(args[i], env)) if (!possible_key(args[i])) err = error(args[i], fd); return (err); }