mirror of
https://github.com/drasko/codezero.git
synced 2026-01-30 19:53:14 +01:00
Added a memlayout.txt, revised README, reduced env size to 4kb
This commit is contained in:
34
tasks/libposix/env.c
Normal file
34
tasks/libposix/env.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Environment accessor functions
|
||||
*
|
||||
* Copyright (C) 2008 Bahadir Balban
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char **__environ;
|
||||
|
||||
/*
|
||||
* Search for given name in name=value string pairs located
|
||||
* in the environment segment, and return the pointer to value
|
||||
* string.
|
||||
*/
|
||||
char *getenv(const char *name)
|
||||
{
|
||||
char **envp = __environ;
|
||||
int length;
|
||||
|
||||
if (!envp)
|
||||
return 0;
|
||||
length = strlen(name);
|
||||
|
||||
while(*envp) {
|
||||
if (memcmp(name, *envp, length) == 0 &&
|
||||
(*envp)[length] == '=')
|
||||
return *envp + length + 1;
|
||||
envp++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#define TASK_FILES_MAX 32
|
||||
|
||||
/* POSIX minimum is 4Kb */
|
||||
#define DEFAULT_ENV_SIZE SZ_16K
|
||||
#define DEFAULT_ENV_SIZE SZ_4K
|
||||
#define DEFAULT_STACK_SIZE SZ_16K
|
||||
#define DEFAULT_UTCB_SIZE PAGE_SIZE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user