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:
LuckyLaszlo
2021-11-26 20:44:29 +01:00
parent 3465354af5
commit 18d430c5cb
13 changed files with 119 additions and 239 deletions

View File

@@ -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);
}