MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / windirent_getenv

Function windirent_getenv

modules/dasSQLITE/sqlite/shell.c:1351–1373  ·  view source on GitHub ↗

** Implementation of the POSIX getenv() function using the Win32 API. ** This function is not thread-safe. */

Source from the content-addressed store, hash-verified

1349** This function is not thread-safe.
1350*/
1351const char *windirent_getenv(
1352 const char *name
1353){
1354 static char value[32768]; /* Maximum length, per MSDN */
1355 DWORD dwSize = sizeof(value) / sizeof(char); /* Size in chars */
1356 DWORD dwRet; /* Value returned by GetEnvironmentVariableA() */
1357
1358 memset(value, 0, sizeof(value));
1359 dwRet = GetEnvironmentVariableA(name, value, dwSize);
1360 if( dwRet==0 || dwRet>dwSize ){
1361 /*
1362 ** The function call to GetEnvironmentVariableA() failed -OR-
1363 ** the buffer is not large enough. Either way, return NULL.
1364 */
1365 return 0;
1366 }else{
1367 /*
1368 ** The function call to GetEnvironmentVariableA() succeeded
1369 ** -AND- the buffer contains the entire value.
1370 */
1371 return value;
1372 }
1373}
1374
1375/*
1376** Implementation of the POSIX opendir() function using the MSVCRT.

Callers 1

opendirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected