28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* :::::::: */
|
|
/* builtin_unset.c :+: :+: */
|
|
/* +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
|
/* +#+ */
|
|
/* Created: 2025/02/20 11:25:43 by whaffman #+# #+# */
|
|
/* Updated: 2025/02/26 16:07:21 by whaffman ######## odam.nl */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
int builtin_unset(t_minishell *msh, t_command *cmd)
|
|
{
|
|
int i;
|
|
|
|
i = 1;
|
|
while (cmd->args[i] != NULL)
|
|
{
|
|
if (environment_get(msh, cmd->args[i]) != NULL)
|
|
environment_del(msh, cmd->args[i]);
|
|
i++;
|
|
}
|
|
return (SUCCESS);
|
|
}
|