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
This commit is contained in:
@@ -5,19 +5,21 @@ int builtin_unset(int argc, char *argv[], t_all *c)
|
||||
{
|
||||
extern char **environ;
|
||||
int env_position;
|
||||
int i;
|
||||
|
||||
(void)argc;
|
||||
(void)c;
|
||||
env_position = getenv_position(environ, argv[1]);
|
||||
if (environ[env_position] == '\0')
|
||||
return (0);
|
||||
while (environ[env_position + 1])
|
||||
i = 1;
|
||||
while (argv[i])
|
||||
{
|
||||
env_position = getenv_position(environ, argv[i]);
|
||||
free(environ[env_position]);
|
||||
environ[env_position] = ft_strdup(environ[env_position + 1]);
|
||||
env_position++;
|
||||
while (environ[env_position])
|
||||
{
|
||||
environ[env_position] = environ[env_position + 1];
|
||||
env_position++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
free(environ[env_position]);
|
||||
environ[env_position] = NULL;
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user