2007-03-14 20:24:57 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS system libraries
|
|
|
|
* FILE: lib/crt/??????
|
|
|
|
* PURPOSE: Unknown
|
|
|
|
* PROGRAMER: Unknown
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* 25/11/05: Added license header
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
2008-12-13 21:28:05 +00:00
|
|
|
//#undef environ
|
2007-03-14 20:24:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
char *getenv(const char *name)
|
|
|
|
{
|
|
|
|
char **environ;
|
|
|
|
unsigned int length = strlen(name);
|
|
|
|
|
|
|
|
for (environ = *__p__environ(); *environ; environ++)
|
|
|
|
{
|
|
|
|
char *str = *environ;
|
|
|
|
char *pos = strchr(str,'=');
|
|
|
|
if (pos && ((unsigned int)(pos - str) == length) && !_strnicmp(str, name, length))
|
|
|
|
return pos + 1;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
wchar_t *_wgetenv(const wchar_t *name)
|
|
|
|
{
|
|
|
|
wchar_t **environ;
|
|
|
|
unsigned int length = wcslen(name);
|
|
|
|
|
|
|
|
for (environ = *__p__wenviron(); *environ; environ++)
|
|
|
|
{
|
|
|
|
wchar_t *str = *environ;
|
|
|
|
wchar_t *pos = wcschr(str, L'=');
|
|
|
|
if (pos && ((unsigned int)(pos - str) == length) && !_wcsnicmp(str, name, length))
|
|
|
|
return pos + 1;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|