ctype.h, getenv
This commit is contained in:
parent
f973ff8cb8
commit
23198d16f4
7 changed files with 148 additions and 12 deletions
19
05/stdlib.h
Normal file
19
05/stdlib.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef _STDLIB_H
|
||||
#define _STDLIB_H
|
||||
|
||||
#include <stdc_common.h>
|
||||
|
||||
char *getenv(const char *name) {
|
||||
int i, j;
|
||||
for (i = 0; _envp[i]; ++i) {
|
||||
char *key = _envp[i];
|
||||
for (j = 0; key[j] != '=' && name[j]; ++j)
|
||||
if (name[j] != key[j])
|
||||
break;
|
||||
if (key[j] == '=' && !name[j])
|
||||
return key + (j+1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // _STDLIB_H
|
Loading…
Add table
Add a link
Reference in a new issue