30 lines
624 B
C
30 lines
624 B
C
|
|
#include "minishell.h"
|
|
|
|
int builtin_unset(int argc, char *argv[], t_all *c)
|
|
{
|
|
int position;
|
|
extern char **environ;
|
|
|
|
(void)argc;
|
|
(void)c;
|
|
//position = getenv_position(c->envp, argv[1]);
|
|
position = getenv_position(environ, argv[1]);
|
|
if (position == -1)
|
|
return (0);
|
|
// while (c->envp[position])
|
|
while (environ[position])
|
|
{
|
|
write(1, "1", 1);
|
|
//free(c->envp[position]);
|
|
free(environ[position]);
|
|
//c->envp[position] = ft_strdup(c->envp[position + 1]);
|
|
environ[position] = ft_strdup(environ[position + 1]);
|
|
position++;
|
|
}
|
|
write(1, "2", 1);
|
|
//free(c->envp[position]);
|
|
free(environ[position]);
|
|
return (0);
|
|
}
|