ReactOS  0.4.14-dev-831-gef8c9239
getenv.c File Reference
#include <precomp.h>
Include dependency graph for getenv.c:

Go to the source code of this file.

Functions

chargetenv (const char *name)
 
wchar_t_wgetenv (const wchar_t *name)
 

Function Documentation

◆ _wgetenv()

wchar_t* _wgetenv ( const wchar_t name)

Definition at line 35 of file getenv.c.

36 {
37  wchar_t **env;
38  size_t length = wcslen(name);
39 
40  for (env = *__p__wenviron(); *env; env++)
41  {
42  wchar_t *str = *env;
43  wchar_t *pos = wcschr(str, L'=');
44  if (pos && ((unsigned int)(pos - str) == length) && !_wcsnicmp(str, name, length))
45  return pos + 1;
46  }
47  return NULL;
48 }
_CRTIMP wchar_t ***__cdecl __p__wenviron()
Definition: environ.c:392
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static const WCHAR L[]
Definition: oid.c:1250
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:168
Definition: name.c:38
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ getenv()

char* getenv ( const char name)

Definition at line 17 of file getenv.c.

18 {
19  char **env;
20  size_t length = strlen(name);
21 
22  for (env = *__p__environ(); *env; env++)
23  {
24  char *str = *env;
25  char *pos = strchr(str,'=');
26  if (pos && ((unsigned int)(pos - str) == length) && !_strnicmp(str, name, length))
27  return pos + 1;
28  }
29  return NULL;
30 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
_CRTIMP char ***__cdecl __p__environ()
Definition: environ.c:384
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:168
char * strchr(const char *String, int ch)
Definition: utclib.c:501
Definition: name.c:38