Changeset 936 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Feb 15, 2007 8:58:51 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/env-posix.cpp
r935 r936 1 1 /* $Id$ */ 2 2 /** @file 3 * InnoTek Portable Runtime - Assertions, generic RTAssertDoBreakpoint.3 * InnoTek Portable Runtime - Environment, Posix. 4 4 */ 5 5 … … 24 24 * Header Files * 25 25 *******************************************************************************/ 26 #include <iprt/assert.h> 26 #include <iprt/env.h> 27 #include <iprt/string.h> 28 29 #include <stdlib.h> 30 #include <errno.h> 27 31 28 32 29 33 /** 30 * Overridable function that decides whether assertions executes the breakpoint or not.34 * Gets an environment variable (getenv). 31 35 * 32 * The generic implementation will return true. 36 * The caller is responsible for ensuring that nobody changes the environment 37 * while it's using the returned string pointer! 33 38 * 34 * @returns true if the breakpoint should be hit, false if it should be ignored. 35 * @remark The RTDECL() makes this a bit difficult to override on windows. Sorry. 39 * @returns Pointer to read only string on success, NULL if the variable wasn't found. 40 * 41 * @param pszVar The environment variable name. 36 42 */ 37 RTDECL( bool) RTAssertDoBreakpoint(void)43 RTDECL(const char *) RTEnvGet(const char *pszVar) 38 44 { 39 return true;45 return getenv(pszVar); 40 46 } 41 47 48 49 /** 50 * Puts an variable=value string into the environment (putenv). 51 * 52 * @returns IPRT status code. Typical error is VERR_NO_MEMORY. 53 * 54 * @param pszVarEqualValue The variable '=' value string. If the value and '=' is 55 * omitted, the variable is removed from the environment. 56 */ 57 RTDECL(int) RTEnvPut(const char *pszVarEqualValue) 58 { 59 /** @todo putenv is a memory leak. deal with this on a per system basis. */ 60 if (!putenv((char *)pszVarEqualValue)) 61 return 0; 62 return RTErrConvertFromErrno(errno); 63 } 64
Note:
See TracChangeset
for help on using the changeset viewer.