source: asp3_tinet_ecnl_arm/trunk/musl-1.1.18/src/env/unsetenv.c@ 400

Last change on this file since 400 was 400, checked in by coas-nagasima, 5 years ago

ファイルヘッダーの更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 562 bytes
Line 
1#include <stdlib.h>
2#include <string.h>
3#include <errno.h>
4#include "libc.h"
5
6char *__strchrnul(const char *, int);
7
8static void dummy(char *old, char *new) {}
9weak_alias(dummy, __env_rm_add);
10
11int unsetenv(const char *name)
12{
13 size_t l = __strchrnul(name, '=') - name;
14 if (!l || name[l]) {
15 errno = EINVAL;
16 return -1;
17 }
18 if (__environ) {
19 char **e = __environ, **eo = e;
20 for (; *e; e++)
21 if (!strncmp(name, *e, l) && l[*e] == '=')
22 __env_rm_add(*e, 0);
23 else if (eo != e)
24 *eo++ = *e;
25 else
26 eo++;
27 if (eo != e) *eo = 0;
28 }
29 return 0;
30}
Note: See TracBrowser for help on using the repository browser.