5 extern char **__environ
;
6 extern char **__env_map
;
8 int unsetenv(const char *name
)
11 size_t l
= strlen(name
);
13 if (!*name
|| strchr(name
, '=')) {
18 for (i
=0; __environ
[i
] && (memcmp(name
, __environ
[i
], l
) || __environ
[i
][l
] != '='); i
++);
21 for (j
=0; __env_map
[j
] && __env_map
[j
] != __environ
[i
]; j
++);
23 for (; __env_map
[j
]; j
++)
24 __env_map
[j
] = __env_map
[j
+1];
26 for (; __environ
[i
]; i
++)
27 __environ
[i
] = __environ
[i
+1];