MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / readenv

Function readenv

src/common/utils.cpp:278–301  ·  view source on GitHub ↗

r e a d e n v Goes to read directly the environment variables from the operating system on Windows and provides a stub for UNIX.

Source from the content-addressed store, hash-verified

276// Goes to read directly the environment variables from the operating system on Windows
277// and provides a stub for UNIX.
278bool readenv(const char* env_name, Firebird::string& env_value)
279{
280#ifdef WIN_NT
281 const DWORD rc = GetEnvironmentVariable(env_name, NULL, 0);
282 if (rc)
283 {
284 env_value.reserve(rc - 1);
285 DWORD rc2 = GetEnvironmentVariable(env_name, env_value.begin(), rc);
286 if (rc2 < rc && rc2 != 0)
287 {
288 env_value.recalculate_length();
289 return true;
290 }
291 }
292#else
293 const char* p = getenv(env_name);
294 if (p)
295 return env_value.assign(p).length() != 0;
296#endif
297 // Not found, clear the output var.
298 env_value.begin()[0] = 0;
299 env_value.recalculate_length();
300 return false;
301}
302
303
304bool readenv(const char* env_name, Firebird::PathName& env_value)

Callers 14

accept_connectionFunction · 0.85
CLIB_ROUTINE mainFunction · 0.85
parseExternalValueFunction · 0.85
setPathFunction · 0.85
charmapNameMethod · 0.85
bootBuildFunction · 0.85
TimeZoneDataPathMethod · 0.85
API_ROUTINE gds__editFunction · 0.85
setTagFunction · 0.85

Calls 6

recalculate_lengthMethod · 0.80
reserveMethod · 0.45
beginMethod · 0.45
lengthMethod · 0.45
assignMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected