X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/91b8de8dee3e7ae3c4edc0ab0923b84bba20d9c4..80d895cd3f624f28424cc45b9b516bf439da9c19:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index f0f3439033..e9510f7235 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -58,28 +58,28 @@ #if !defined(HAVE_USLEEP) && \ (defined(__SUN__) && !defined(__SunOs_5_6) && \ !defined(__SunOs_5_7) && !defined(__SUNPRO_CC)) || \ - defined(__osf__) + defined(__osf__) || defined(__EMX__) extern "C" { #ifdef __SUN__ int usleep(unsigned int usec); #else // !Sun - void usleep(unsigned long usec); - #endif // Sun/!Sun + #ifdef __EMX + /* I copied this from the XFree86 diffs. AV. */ + #define INCL_DOSPROCESS + #include + void usleep(unsigned long delay) + { + DosSleep(delay ? (delay/1000l) : 1l); + } + #else + void usleep(unsigned long usec); + #endif + #endif // Sun/EMX/Something else }; +#define HAVE_USLEEP 1 #endif // Unices without usleep() -#ifdef __EMX__ - /* I copied this from the XFree86 diffs. AV. */ -extern void DosSleep(unsigned long); -#define INCL_DOSPROCESS -#include -void usleep(unsigned long delay) -{ - DosSleep(delay ? (delay/1000l) : 1l); -} -#endif - // ============================================================================ // implementation // ============================================================================ @@ -255,7 +255,7 @@ long wxExecute( wxChar **argv, bool sync, wxProcess *process ) char *mb_argv[WXEXECUTE_NARGS]; while (argv[mb_argc]) { - wxWX2MBbuf mb_arg = wxConv_libc.cWX2MB(argv[mb_argc]); + wxWX2MBbuf mb_arg = wxConvCurrent->cWX2MB(argv[mb_argc]); mb_argv[mb_argc] = strdup(mb_arg); mb_argc++; } @@ -277,7 +277,7 @@ long wxExecute( wxChar **argv, bool sync, wxProcess *process ) } // fork the process -#ifdef HAVE_VFORK +#if HAVE_VFORK pid_t pid = vfork(); #else pid_t pid = fork(); @@ -404,7 +404,7 @@ char *wxGetUserHome( const wxString &user ) } if ((ptr = wxGetenv(_T("USER"))) != NULL || (ptr = wxGetenv(_T("LOGNAME"))) != NULL) { - who = getpwnam(wxConv_libc.cWX2MB(ptr)); + who = getpwnam(wxConvCurrent->cWX2MB(ptr)); } // We now make sure the the user exists! @@ -419,7 +419,7 @@ char *wxGetUserHome( const wxString &user ) } #if wxUSE_UNICODE - return who ? wxConv_libc.cMB2WX(who->pw_dir) : (wxMB2WXbuf)((wxChar*)NULL); + return who ? wxConvCurrent->cMB2WX(who->pw_dir) : (wxMB2WXbuf)((wxChar*)NULL); #else return who ? who->pw_dir : ((char*)NULL); #endif @@ -444,7 +444,7 @@ static bool wxGetHostNameInternal(wxChar *buf, int sz) bool ok = uname(&uts) != -1; if ( ok ) { - wxStrncpy(buf, wxConv_libc.cMB2WX(uts.nodename), sz - 1); + wxStrncpy(buf, wxConvCurrent->cMB2WX(uts.nodename), sz - 1); buf[sz] = _T('\0'); } #elif defined(HAVE_GETHOSTNAME) @@ -490,7 +490,7 @@ bool wxGetFullHostName(wxChar *buf, int sz) { if ( !wxStrchr(buf, _T('.')) ) { - struct hostent *host = gethostbyname(wxConv_libc.cWX2MB(buf)); + struct hostent *host = gethostbyname(wxConvCurrent->cWX2MB(buf)); if ( !host ) { wxLogSysError(_("Cannot get the official hostname")); @@ -500,7 +500,7 @@ bool wxGetFullHostName(wxChar *buf, int sz) else { // the canonical name - wxStrncpy(buf, wxConv_libc.cMB2WX(host->h_name), sz); + wxStrncpy(buf, wxConvCurrent->cMB2WX(host->h_name), sz); } } //else: it's already a FQDN (BSD behaves this way) @@ -516,7 +516,7 @@ bool wxGetUserId(wxChar *buf, int sz) *buf = _T('\0'); if ((who = getpwuid(getuid ())) != NULL) { - wxStrncpy (buf, wxConv_libc.cMB2WX(who->pw_name), sz - 1); + wxStrncpy (buf, wxConvCurrent->cMB2WX(who->pw_name), sz - 1); return TRUE; } @@ -533,7 +533,7 @@ bool wxGetUserName(wxChar *buf, int sz) comma = strchr(who->pw_gecos, ','); if (comma) *comma = '\0'; // cut off non-name comment fields - wxStrncpy (buf, wxConv_libc.cMB2WX(who->pw_gecos), sz - 1); + wxStrncpy (buf, wxConvCurrent->cMB2WX(who->pw_gecos), sz - 1); return TRUE; }