Files
42_INT_07_minishell/srcs/builtins/unset.c
LuckyLaszlo 843b6d84c5 "extern char **environ" in header file
+ global var g_all deleted, renamed switch_heredoc_sigint
2021-11-26 21:58:52 +01:00

25 lines
383 B
C

#include "minishell.h"
int builtin_unset(int argc, char *argv[], t_all *c)
{
int env_position;
int i;
(void)argc;
(void)c;
i = 1;
while (argv[i])
{
env_position = getenv_position(environ, argv[i]);
free(environ[env_position]);
while (environ[env_position])
{
environ[env_position] = environ[env_position + 1];
env_position++;
}
i++;
}
return (0);
}