X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/783388d5d9d025ddc1b4fe1d8edb4e2bf32df66b..1722a3f626f7b29b42a22fc6329ce12fb5e8ed90:/src/os2/utils.cpp?ds=inline diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index c32be9c6e6..00aafc22cb 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -83,7 +83,8 @@ bool wxGetHostName( wxChar* zBuf, int nMaxSize ) wxChar* zSysname; const wxChar* zDefaultHost = _T("noname"); - if ((zSysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL) + if ((zSysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL && + (zSysname = wxGetenv(_T("HOSTNAME"))) == NULL) { ::PrfQueryProfileString( HINI_PROFILE ,(PSZ)WX_SECTION @@ -156,7 +157,7 @@ bool wxShell( const wxString& rCommand ) SData.PgmName = (char*)zShell; sInputs = _T("/C ") + rCommand; - SData.PgmInputs = (BYTE*)sInputs.c_str(); + SData.PgmInputs = (BYTE*)sInputs.wx_str(); SData.TermQ = 0; SData.Environment = 0; SData.InheritOpt = SSF_INHERTOPT_SHELL; @@ -237,11 +238,10 @@ bool wxGetEnv(const wxString& var, wxString *value) return true; } -bool wxSetEnv(const wxString& variable, const wxChar *value) +bool wxSetEnv(const wxString& variable, const char *value) { #if defined(HAVE_SETENV) - return setenv(variable.mb_str(), value ? wxString(value).mb_str().data() - : NULL, 1 /* overwrite */) == 0; + return setenv(variable.mb_str(), value, 1 /* overwrite */) == 0; #elif defined(HAVE_PUTENV) wxString s = variable; if ( value ) @@ -262,6 +262,16 @@ bool wxSetEnv(const wxString& variable, const wxChar *value) #endif } +bool wxSetEnv(const wxString& variable, const wxString& value) +{ + return wxDoSetEnv(variable, value.mb_str()); +} + +bool wxUnsetEnv(const wxString& variable) +{ + return wxDoSetEnv(variable, NULL); +} + void wxMilliSleep( unsigned long ulMilliseconds )