Files
42_INT_07_minishell/srcs/builtins/unset.c
LuckyLaszlo 18d430c5cb CO-CODE Hugo-Luke
+ last_exit_status set/get functions for here_doc
+ TODO : replace all occurences of last_exit_status
+ **environ fix
+ builtin_unset() fix
2021-11-26 20:44:29 +01:00

26 lines
407 B
C

#include "minishell.h"
int builtin_unset(int argc, char *argv[], t_all *c)
{
extern char **environ;
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);
}