ctype.h, getenv

This commit is contained in:
pommicket 2022-02-15 16:36:52 -05:00
parent f973ff8cb8
commit 23198d16f4
7 changed files with 148 additions and 12 deletions

19
05/stdlib.h Normal file
View 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