rem: dprintf("sys_setenv: entry (name=%s, value=%s)\n", name, value);
add: TRACE(("sys_setenv: entry (name=%s, value=%s)\n", name, value));
context: sys_setenv(const char *name, const char *value, int overwrite){	char var[SYS_THREAD_STRING_LENGTH_MAX];	int state;	addr env_space;	char **envp;	int envc;	bool var_exists = false;	int var_pos = 0;	int name_size;	int rc = 0;	int i;	char *p;	// ToDo: please put me out of the kernel into libroot.so!	dprintf("sys_setenv: entry (name=%s, value=%s)\n", name, value);	if (strlen(name) + strlen(value) + 1 >= SYS_THREAD_STRING_LENGTH_MAX)		return -1;	state = disable_interrupts();	GRAB_TEAM_LOCK();	strcpy(var, name);	strncat(var, "=", SYS_THREAD_STRING_LENGTH_MAX-1);	name_size = strlen(var);	strncat(var, value, SYS_THREAD_STRING_LENGTH_MAX-1);	env_space = (addr)thread_get_current_thread()->team->user_env_base;	envp = (char **)env_space;	for (envc = 0; envp[envc]; envc++) {		if (!strncmp(envp[envc], var, name_size)) {			var_exists = true;			var_pos = envc;		}	}	if (!var_exists)		var_pos = envc;	dprintf("sys_setenv: variable does%s exist\n", var_exists ? "" : " not");	if ((!var_exists) || (var_exists && overwrite)) {		// XXX- make a better allocator		if (var_exists) {			if (strlen(var) <= strlen(envp[var_pos])) {				strcpy(envp[var_pos], var);			} else {				for (p = (char *)env_space + ENV_SIZE - 1, i = 0; envp[i]; i++)					if (envp[i] < p)						p = envp[i];				p -= (strlen(var) + 1);				if (p < (char *)env_space + (envc * sizeof(char *))) {					rc = -1;				} else {					envp[var_pos] = p;					strcpy(envp[var_pos], var);				}			}		}		else {			for (p = (char *)env_space + ENV_SIZE - 1, i=0; envp[i]; i++)				if (envp[i] < p)					p = envp[i];			p -= (strlen(var) + 1);			if (p < (char *)env_space + ((envc + 1) * sizeof(char *))) {				rc = -1;			} else {				envp[envc] = p;				strcpy(envp[envc], var);				envp[envc + 1] = NULL;			}		}	}	dprintf("sys_setenv: variable set.\n");	RELEASE_TEAM_LOCK();	restore_interrupts(state);		return rc;}