/////////////////////////////////////////////////////////////////////////////
-// Name: utils.cpp
+// Name: src/os2/utils.cpp
// Purpose: Various utilities
// Author: David Webster
// Modified by:
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
+#include "wx/utils.h"
+
#ifndef WX_PRECOMP
- #include "wx/setup.h"
- #include "wx/utils.h"
#include "wx/app.h"
+ #include "wx/intl.h"
+ #include "wx/log.h"
#endif //WX_PRECOMP
#include "wx/os2/private.h"
-#include "wx/intl.h"
#include "wx/apptrait.h"
#include <ctype.h>
#include <dirent.h>
#endif
-#include "wx/log.h"
#include <io.h>
// functions beyond those provided by WinSock
// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
-bool wxGetHostName(
- wxChar* zBuf
-, int nMaxSize
-)
+bool wxGetHostName( wxChar* zBuf, int nMaxSize )
{
-#if wxUSE_NET_API
- char zServer[256];
- char zComputer[256];
- unsigned long ulLevel = 0;
- unsigned char* zBuffer = NULL;
- unsigned long ulBuffer = 256;
- unsigned long* pulTotalAvail = NULL;
+ if (!zBuf) return false;
+
+#if defined(wxUSE_NET_API) && wxUSE_NET_API
+ char zServer[256];
+ char zComputer[256];
+ unsigned long ulLevel = 0;
+ unsigned char* zBuffer = NULL;
+ unsigned long ulBuffer = 256;
+ unsigned long* pulTotalAvail = NULL;
NetBios32GetInfo( (const unsigned char*)zServer
,(const unsigned char*)zComputer
);
strcpy(zBuf, zServer);
#else
- wxChar* zSysname;
- const wxChar* zDefaultHost = _T("noname");
+ wxChar* zSysname;
+ const wxChar* zDefaultHost = _T("noname");
if ((zSysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL)
{
);
}
else
+ {
wxStrncpy(zBuf, zSysname, nMaxSize - 1);
+ }
+
zBuf[nMaxSize] = _T('\0');
#endif
+
return *zBuf ? true : false;
}
//
// Execute a program in an Interactive Shell
//
-bool wxShell(
- const wxString& rCommand
-)
+bool wxShell( const wxString& rCommand )
{
- wxChar* zShell = _T("CMD.EXE");
- wxString sInputs;
- STARTDATA SData = {0};
- PSZ PgmTitle = "Command Shell";
- APIRET rc;
- PID vPid = 0;
- ULONG ulSessID = 0;
- UCHAR achObjBuf[256] = {0}; //error data if DosStart fails
- RESULTCODES vResult;
+ wxChar* zShell = _T("CMD.EXE");
+ wxString sInputs;
+ STARTDATA SData = {0};
+ PSZ PgmTitle = "Command Shell";
+ APIRET rc;
+ PID vPid = 0;
+ ULONG ulSessID = 0;
+ UCHAR achObjBuf[256] = {0}; //error data if DosStart fails
+ RESULTCODES vResult;
SData.Length = sizeof(STARTDATA);
SData.Related = SSF_RELATED_INDEPENDENT;
return false;
}
-wxPowerType wxGetPowerType()
-{
- // TODO
- return wxPOWER_UNKNOWN;
-}
-
-wxBatteryState wxGetBatteryState()
-{
- // TODO
- return wxBATTERY_UNKNOWN_STATE;
-}
-
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
wxMemorySize wxGetFreeMemory()
{
return (wxChar*)wxEmptyString; // No home known!
}
-wxString WXDLLEXPORT wxPMErrorToStr(ERRORID vError)
+wxString wxPMErrorToStr(ERRORID vError)
{
- wxString sError;
+ wxString sError;
//
// Remove the high order byte -- it is useless
default:
sError = wxT("Unknown error");
}
- return(sError);
+ return sError;
} // end of wxPMErrorToStr
// replacement for implementation in unix/utilsunx.cpp,