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