1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: generic Unix implementation of many wx functions
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // ============================================================================
12 // ============================================================================
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
19 #include "wx/string.h"
26 #include "wx/process.h"
27 #include "wx/thread.h"
29 #include "wx/stream.h"
36 #include "wx/unix/execute.h"
39 // SGI signal.h defines signal handler arguments differently depending on
40 // whether _LANGUAGE_C_PLUS_PLUS is set or not - do set it
41 #if defined(__SGI__) && !defined(_LANGUAGE_C_PLUS_PLUS)
42 #define _LANGUAGE_C_PLUS_PLUS 1
49 #include <sys/types.h>
56 #include <fcntl.h> // for O_WRONLY and friends
57 #include <time.h> // nanosleep() and/or usleep()
58 #include <ctype.h> // isspace()
59 #include <sys/time.h> // needed for FD_SETSIZE
62 #include <sys/utsname.h> // for uname()
65 // ----------------------------------------------------------------------------
66 // conditional compilation
67 // ----------------------------------------------------------------------------
69 // many versions of Unices have this function, but it is not defined in system
70 // headers - please add your system here if it is the case for your OS.
71 // SunOS < 5.6 (i.e. Solaris < 2.6) and DG-UX are like this.
72 #if !defined(HAVE_USLEEP) && \
73 (defined(__SUN__) && !defined(__SunOs_5_6) && \
74 !defined(__SunOs_5_7) && !defined(__SUNPRO_CC)) || \
75 defined(__osf__) || defined(__EMX__)
79 int usleep(unsigned int usec
);
82 /* I copied this from the XFree86 diffs. AV. */
83 #define INCL_DOSPROCESS
85 inline void usleep(unsigned long delay
)
87 DosSleep(delay
? (delay
/1000l) : 1l);
90 void usleep(unsigned long usec
);
92 #endif // Sun/EMX/Something else
96 #endif // Unices without usleep()
98 // ============================================================================
100 // ============================================================================
102 // ----------------------------------------------------------------------------
104 // ----------------------------------------------------------------------------
106 void wxSleep(int nSecs
)
111 void wxUsleep(unsigned long milliseconds
)
113 #if defined(HAVE_NANOSLEEP)
115 tmReq
.tv_sec
= (time_t)(milliseconds
/ 1000);
116 tmReq
.tv_nsec
= (milliseconds
% 1000) * 1000 * 1000;
118 // we're not interested in remaining time nor in return value
119 (void)nanosleep(&tmReq
, (timespec
*)NULL
);
120 #elif defined(HAVE_USLEEP)
121 // uncomment this if you feel brave or if you are sure that your version
122 // of Solaris has a safe usleep() function but please notice that usleep()
123 // is known to lead to crashes in MT programs in Solaris 2.[67] and is not
124 // documented as MT-Safe
125 #if defined(__SUN__) && wxUSE_THREADS
126 #error "usleep() cannot be used in MT programs under Solaris."
129 usleep(milliseconds
* 1000); // usleep(3) wants microseconds
130 #elif defined(HAVE_SLEEP)
131 // under BeOS sleep() takes seconds (what about other platforms, if any?)
132 sleep(milliseconds
* 1000);
133 #else // !sleep function
134 #error "usleep() or nanosleep() function required for wxUsleep"
135 #endif // sleep function
138 // ----------------------------------------------------------------------------
139 // process management
140 // ----------------------------------------------------------------------------
142 int wxKill(long pid
, wxSignal sig
, wxKillError
*rc
)
144 int err
= kill((pid_t
)pid
, (int)sig
);
154 *rc
= wxKILL_BAD_SIGNAL
;
158 *rc
= wxKILL_ACCESS_DENIED
;
162 *rc
= wxKILL_NO_PROCESS
;
166 // this goes against Unix98 docs so log it
167 wxLogDebug(_T("unexpected kill(2) return value %d"), err
);
177 #define WXEXECUTE_NARGS 127
179 long wxExecute( const wxString
& command
, bool sync
, wxProcess
*process
)
181 wxCHECK_MSG( !command
.IsEmpty(), 0, wxT("can't exec empty command") );
184 wxChar
*argv
[WXEXECUTE_NARGS
];
186 const wxChar
*cptr
= command
.c_str();
187 wxChar quotechar
= wxT('\0'); // is arg quoted?
188 bool escaped
= FALSE
;
190 // split the command line in arguments
194 quotechar
= wxT('\0');
196 // eat leading whitespace:
197 while ( wxIsspace(*cptr
) )
200 if ( *cptr
== wxT('\'') || *cptr
== wxT('"') )
205 if ( *cptr
== wxT('\\') && ! escaped
)
212 // all other characters:
216 // have we reached the end of the argument?
217 if ( (*cptr
== quotechar
&& ! escaped
)
218 || (quotechar
== wxT('\0') && wxIsspace(*cptr
))
219 || *cptr
== wxT('\0') )
221 wxASSERT_MSG( argc
< WXEXECUTE_NARGS
,
222 wxT("too many arguments in wxExecute") );
224 argv
[argc
] = new wxChar
[argument
.length() + 1];
225 wxStrcpy(argv
[argc
], argument
.c_str());
228 // if not at end of buffer, swallow last character:
232 break; // done with this one, start over
238 // do execute the command
239 long lRc
= wxExecute(argv
, sync
, process
);
244 delete [] argv
[argc
++];
249 // ----------------------------------------------------------------------------
251 // ----------------------------------------------------------------------------
253 static wxString
wxMakeShellCommand(const wxString
& command
)
258 // just an interactive shell
263 // execute command in a shell
264 cmd
<< _T("/bin/sh -c '") << command
<< _T('\'');
270 bool wxShell(const wxString
& command
)
272 return wxExecute(wxMakeShellCommand(command
), TRUE
/* sync */) == 0;
275 bool wxShell(const wxString
& command
, wxArrayString
& output
)
277 wxCHECK_MSG( !!command
, FALSE
, _T("can't exec shell non interactively") );
279 return wxExecute(wxMakeShellCommand(command
), output
);
284 void wxHandleProcessTermination(wxEndProcessData
*proc_data
)
286 int pid
= (proc_data
->pid
> 0) ? proc_data
->pid
: -(proc_data
->pid
);
288 // waitpid is POSIX so should be available everywhere, however on older
289 // systems wait() might be used instead in a loop (until the right pid
294 // wait for child termination and if waitpid() was interrupted, try again
297 rc
= waitpid(pid
, &status
, 0);
299 while ( rc
== -1 && errno
== EINTR
);
303 // JACS: this could happen if the process was terminated and waitpid called,
304 // so commenting out for now.
305 //wxLogSysError(_("Waiting for subprocess termination failed (return code = -1)"));
307 else if (! (WIFEXITED(status
)))
309 wxLogSysError(_("Waiting for subprocess termination failed (WIFEXITED returned zero)"));
311 /* AFAIK, this can only happen if something went wrong within
312 wxGTK, i.e. due to a race condition or some serious bug.
313 After having fixed the order of statements in
314 GTK_EndProcessDetector(). (KB)
317 else if (WIFSIGNALED(status
))
319 wxLogSysError(_("Waiting for subprocess termination failed (signal not caught)"));
321 /* AFAIK, this can only happen if something went wrong within
322 wxGTK, i.e. due to a race condition or some serious bug.
323 After having fixed the order of statements in
324 GTK_EndProcessDetector(). (KB)
329 // notify user about termination if required
330 if (proc_data
->process
)
332 proc_data
->process
->OnTerminate(proc_data
->pid
,
333 WEXITSTATUS(status
));
336 if ( proc_data
->pid
> 0 )
342 // wxExecute() will know about it
343 proc_data
->exitcode
= status
;
352 // ----------------------------------------------------------------------------
353 // wxStream classes to support IO redirection in wxExecute
354 // ----------------------------------------------------------------------------
358 class wxProcessFileInputStream
: public wxInputStream
361 wxProcessFileInputStream(int fd
) { m_fd
= fd
; }
362 ~wxProcessFileInputStream() { close(m_fd
); }
364 virtual bool Eof() const;
367 size_t OnSysRead(void *buffer
, size_t bufsize
);
373 class wxProcessFileOutputStream
: public wxOutputStream
376 wxProcessFileOutputStream(int fd
) { m_fd
= fd
; }
377 ~wxProcessFileOutputStream() { close(m_fd
); }
380 size_t OnSysWrite(const void *buffer
, size_t bufsize
);
386 bool wxProcessFileInputStream::Eof() const
388 if ( m_lasterror
== wxSTREAM_EOF
)
391 // check if there is any input available
398 FD_SET(m_fd
, &readfds
);
399 switch ( select(m_fd
+ 1, &readfds
, NULL
, NULL
, &tv
) )
402 wxLogSysError(_("Impossible to get child process input"));
409 wxFAIL_MSG(_T("unexpected select() return value"));
410 // still fall through
413 // input available: check if there is any
414 return wxInputStream::Eof();
418 size_t wxProcessFileInputStream::OnSysRead(void *buffer
, size_t bufsize
)
420 int ret
= read(m_fd
, buffer
, bufsize
);
423 m_lasterror
= wxSTREAM_EOF
;
425 else if ( ret
== -1 )
427 m_lasterror
= wxSTREAM_READ_ERROR
;
432 m_lasterror
= wxSTREAM_NOERROR
;
438 size_t wxProcessFileOutputStream::OnSysWrite(const void *buffer
, size_t bufsize
)
440 int ret
= write(m_fd
, buffer
, bufsize
);
443 m_lasterror
= wxSTREAM_WRITE_ERROR
;
448 m_lasterror
= wxSTREAM_NOERROR
;
454 #endif // wxUSE_STREAMS
456 long wxExecute(wxChar
**argv
,
460 // for the sync execution, we return -1 to indicate failure, but for async
461 // case we return 0 which is never a valid PID
463 // we define this as a macro, not a variable, to avoid compiler warnings
464 // about "ERROR_RETURN_CODE value may be clobbered by fork()"
465 #define ERROR_RETURN_CODE ((sync) ? -1 : 0)
467 wxCHECK_MSG( *argv
, ERROR_RETURN_CODE
, wxT("can't exec empty command") );
471 char *mb_argv
[WXEXECUTE_NARGS
];
473 while (argv
[mb_argc
])
475 wxWX2MBbuf mb_arg
= wxConvertWX2MB(argv
[mb_argc
]);
476 mb_argv
[mb_argc
] = strdup(mb_arg
);
479 mb_argv
[mb_argc
] = (char *) NULL
;
481 // this macro will free memory we used above
482 #define ARGS_CLEANUP \
483 for ( mb_argc = 0; mb_argv[mb_argc]; mb_argc++ ) \
484 free(mb_argv[mb_argc])
486 // no need for cleanup
489 wxChar
**mb_argv
= argv
;
490 #endif // Unicode/ANSI
494 int end_proc_detect
[2];
495 if ( pipe(end_proc_detect
) == -1 )
497 wxLogSysError( _("Pipe creation failed") );
498 wxLogError( _("Failed to execute '%s'\n"), *argv
);
502 return ERROR_RETURN_CODE
;
506 // pipes for inter process communication
507 int pipeIn
[2], // stdin
508 pipeOut
[2], // stdout
509 pipeErr
[2]; // stderr
511 pipeIn
[0] = pipeIn
[1] =
512 pipeOut
[0] = pipeOut
[1] =
513 pipeErr
[0] = pipeErr
[1] = -1;
515 if ( process
&& process
->IsRedirected() )
517 if ( pipe(pipeIn
) == -1 || pipe(pipeOut
) == -1 || pipe(pipeErr
) == -1 )
520 // free previously allocated resources
521 close(end_proc_detect
[0]);
522 close(end_proc_detect
[1]);
525 wxLogSysError( _("Pipe creation failed") );
526 wxLogError( _("Failed to execute '%s'\n"), *argv
);
530 return ERROR_RETURN_CODE
;
541 if ( pid
== -1 ) // error?
544 close(end_proc_detect
[0]);
545 close(end_proc_detect
[1]);
554 wxLogSysError( _("Fork failed") );
558 return ERROR_RETURN_CODE
;
560 else if ( pid
== 0 ) // we're in child
563 close(end_proc_detect
[0]); // close reading side
566 // These lines close the open file descriptors to to avoid any
567 // input/output which might block the process or irritate the user. If
568 // one wants proper IO for the subprocess, the right thing to do is to
569 // start an xterm executing it.
572 for ( int fd
= 0; fd
< FD_SETSIZE
; fd
++ )
574 if ( fd
== pipeIn
[0] || fd
== pipeOut
[1] || fd
== pipeErr
[1]
576 || fd
== end_proc_detect
[1]
580 // don't close this one, we still need it
584 // leave stderr opened too, it won't do any hurm
585 if ( fd
!= STDERR_FILENO
)
590 // redirect stdio, stdout and stderr
591 if ( pipeIn
[0] != -1 )
593 if ( dup2(pipeIn
[0], STDIN_FILENO
) == -1 ||
594 dup2(pipeOut
[1], STDOUT_FILENO
) == -1 ||
595 dup2(pipeErr
[1], STDERR_FILENO
) == -1 )
597 wxLogSysError(_("Failed to redirect child process input/output"));
605 execvp (*mb_argv
, mb_argv
);
607 // there is no return after successful exec()
610 // some compilers complain about missing return - of course, they
611 // should know that exit() doesn't return but what else can we do if
613 #if defined(__VMS) || defined(__INTEL_COMPILER)
617 else // we're in parent
621 // pipe initialization: construction of the wxStreams
622 if ( process
&& process
->IsRedirected() )
625 // These two streams are relative to this process.
626 wxOutputStream
*outStream
= new wxProcessFileOutputStream(pipeIn
[1]);
627 wxInputStream
*inStream
= new wxProcessFileInputStream(pipeOut
[0]);
628 wxInputStream
*errStream
= new wxProcessFileInputStream(pipeErr
[0]);
630 process
->SetPipeStreams(inStream
, outStream
, errStream
);
631 #endif // wxUSE_STREAMS
633 close(pipeIn
[0]); // close reading side
634 close(pipeOut
[1]); // close writing side
635 close(pipeErr
[1]); // close writing side
638 #if wxUSE_GUI && !defined(__WXMICROWIN__)
639 wxEndProcessData
*data
= new wxEndProcessData
;
643 // we may have process for capturing the program output, but it's
644 // not used in wxEndProcessData in the case of sync execution
645 data
->process
= NULL
;
647 // sync execution: indicate it by negating the pid
649 data
->tag
= wxAddProcessCallback(data
, end_proc_detect
[0]);
651 close(end_proc_detect
[1]); // close writing side
656 // it will be set to 0 from GTK_EndProcessDetector
657 while (data
->pid
!= 0)
660 int exitcode
= data
->exitcode
;
666 else // async execution
668 // async execution, nothing special to do - caller will be
669 // notified about the process termination if process != NULL, data
670 // will be deleted in GTK_EndProcessDetector
671 data
->process
= process
;
673 data
->tag
= wxAddProcessCallback(data
, end_proc_detect
[0]);
675 close(end_proc_detect
[1]); // close writing side
680 wxASSERT_MSG( sync
, wxT("async execution not supported yet") );
683 if ( waitpid(pid
, &exitcode
, 0) == -1 || !WIFEXITED(exitcode
) )
685 wxLogSysError(_("Waiting for subprocess termination failed"));
693 #undef ERROR_RETURN_CODE
696 // ----------------------------------------------------------------------------
697 // file and directory functions
698 // ----------------------------------------------------------------------------
700 const wxChar
* wxGetHomeDir( wxString
*home
)
702 *home
= wxGetUserHome( wxString() );
704 if ( home
->IsEmpty() )
708 if ( tmp
.Last() != wxT(']'))
709 if ( tmp
.Last() != wxT('/')) *home
<< wxT('/');
711 return home
->c_str();
715 const wxMB2WXbuf
wxGetUserHome( const wxString
&user
)
716 #else // just for binary compatibility -- there is no 'const' here
717 char *wxGetUserHome( const wxString
&user
)
720 struct passwd
*who
= (struct passwd
*) NULL
;
726 if ((ptr
= wxGetenv(wxT("HOME"))) != NULL
)
730 if ((ptr
= wxGetenv(wxT("USER"))) != NULL
|| (ptr
= wxGetenv(wxT("LOGNAME"))) != NULL
)
732 who
= getpwnam(wxConvertWX2MB(ptr
));
735 // We now make sure the the user exists!
738 who
= getpwuid(getuid());
743 who
= getpwnam (user
.mb_str());
746 return wxConvertMB2WX(who
? who
->pw_dir
: 0);
749 // ----------------------------------------------------------------------------
750 // network and user id routines
751 // ----------------------------------------------------------------------------
753 // retrieve either the hostname or FQDN depending on platform (caller must
754 // check whether it's one or the other, this is why this function is for
756 static bool wxGetHostNameInternal(wxChar
*buf
, int sz
)
758 wxCHECK_MSG( buf
, FALSE
, wxT("NULL pointer in wxGetHostNameInternal") );
762 // we're using uname() which is POSIX instead of less standard sysinfo()
763 #if defined(HAVE_UNAME)
765 bool ok
= uname(&uts
) != -1;
768 wxStrncpy(buf
, wxConvertMB2WX(uts
.nodename
), sz
- 1);
771 #elif defined(HAVE_GETHOSTNAME)
772 bool ok
= gethostname(buf
, sz
) != -1;
773 #else // no uname, no gethostname
774 wxFAIL_MSG(wxT("don't know host name for this machine"));
777 #endif // uname/gethostname
781 wxLogSysError(_("Cannot get the hostname"));
787 bool wxGetHostName(wxChar
*buf
, int sz
)
789 bool ok
= wxGetHostNameInternal(buf
, sz
);
793 // BSD systems return the FQDN, we only want the hostname, so extract
794 // it (we consider that dots are domain separators)
795 wxChar
*dot
= wxStrchr(buf
, wxT('.'));
806 bool wxGetFullHostName(wxChar
*buf
, int sz
)
808 bool ok
= wxGetHostNameInternal(buf
, sz
);
812 if ( !wxStrchr(buf
, wxT('.')) )
814 struct hostent
*host
= gethostbyname(wxConvertWX2MB(buf
));
817 wxLogSysError(_("Cannot get the official hostname"));
823 // the canonical name
824 wxStrncpy(buf
, wxConvertMB2WX(host
->h_name
), sz
);
827 //else: it's already a FQDN (BSD behaves this way)
833 bool wxGetUserId(wxChar
*buf
, int sz
)
838 if ((who
= getpwuid(getuid ())) != NULL
)
840 wxStrncpy (buf
, wxConvertMB2WX(who
->pw_name
), sz
- 1);
847 bool wxGetUserName(wxChar
*buf
, int sz
)
852 if ((who
= getpwuid (getuid ())) != NULL
)
854 // pw_gecos field in struct passwd is not standard
856 char *comma
= strchr(who
->pw_gecos
, ',');
858 *comma
= '\0'; // cut off non-name comment fields
859 wxStrncpy (buf
, wxConvertMB2WX(who
->pw_gecos
), sz
- 1);
860 #else // !HAVE_PW_GECOS
861 wxStrncpy (buf
, wxConvertMB2WX(who
->pw_name
), sz
- 1);
862 #endif // HAVE_PW_GECOS/!HAVE_PW_GECOS
869 wxString
wxGetOsDescription()
871 #ifndef WXWIN_OS_DESCRIPTION
872 #error WXWIN_OS_DESCRIPTION should be defined in config.h by configure
874 return WXWIN_OS_DESCRIPTION
;
878 // this function returns the GUI toolkit version in GUI programs, but OS
879 // version in non-GUI ones
882 int wxGetOsVersion(int *majorVsn
, int *minorVsn
)
887 if ( sscanf(WXWIN_OS_DESCRIPTION
, "%s %d.%d", name
, &major
, &minor
) != 3 )
889 // unreckognized uname string format
903 long wxGetFreeMemory()
905 #if defined(__LINUX__)
906 // get it from /proc/meminfo
907 FILE *fp
= fopen("/proc/meminfo", "r");
913 if ( fgets(buf
, WXSIZEOF(buf
), fp
) && fgets(buf
, WXSIZEOF(buf
), fp
) )
915 long memTotal
, memUsed
;
916 sscanf(buf
, "Mem: %ld %ld %ld", &memTotal
, &memUsed
, &memFree
);
923 #elif defined(__SUN__) && defined(_SC_AVPHYS_PAGES)
924 return sysconf(_SC_AVPHYS_PAGES
)*sysconf(_SC_PAGESIZE
);
925 //#elif defined(__FREEBSD__) -- might use sysctl() to find it out, probably
932 bool wxGetDiskSpace(const wxString
& path
, wxLongLong
*pTotal
, wxLongLong
*pFree
)
937 if ( statfs(path
, &fs
) != 0 )
939 wxLogSysError("Failed to get file system statistics");
946 *pTotal
= wxLongLong(fs
.f_blocks
) * fs
.f_bsize
;
951 *pFree
= wxLongLong(fs
.f_bavail
) * fs
.f_bsize
;
955 #endif // HAVE_STATFS
960 // ----------------------------------------------------------------------------
962 // ----------------------------------------------------------------------------
964 bool wxGetEnv(const wxString
& var
, wxString
*value
)
966 // wxGetenv is defined as getenv()
967 wxChar
*p
= wxGetenv(var
);
979 bool wxSetEnv(const wxString
& variable
, const wxChar
*value
)
981 #if defined(HAVE_SETENV)
982 return setenv(variable
.mb_str(), value
? wxString(value
).mb_str().data()
983 : NULL
, 1 /* overwrite */) == 0;
984 #elif defined(HAVE_PUTENV)
985 wxString s
= variable
;
987 s
<< _T('=') << value
;
990 const char *p
= s
.mb_str();
992 // the string will be free()d by libc
993 char *buf
= (char *)malloc(strlen(p
) + 1);
996 return putenv(buf
) == 0;
997 #else // no way to set an env var
1002 // ----------------------------------------------------------------------------
1004 // ----------------------------------------------------------------------------
1006 #if wxUSE_ON_FATAL_EXCEPTION
1010 static void wxFatalSignalHandler(wxTYPE_SA_HANDLER
)
1014 // give the user a chance to do something special about this
1015 wxTheApp
->OnFatalException();
1021 bool wxHandleFatalExceptions(bool doit
)
1024 static bool s_savedHandlers
= FALSE
;
1025 static struct sigaction s_handlerFPE
,
1031 if ( doit
&& !s_savedHandlers
)
1033 // install the signal handler
1034 struct sigaction act
;
1036 // some systems extend it with non std fields, so zero everything
1037 memset(&act
, 0, sizeof(act
));
1039 act
.sa_handler
= wxFatalSignalHandler
;
1040 sigemptyset(&act
.sa_mask
);
1043 ok
&= sigaction(SIGFPE
, &act
, &s_handlerFPE
) == 0;
1044 ok
&= sigaction(SIGILL
, &act
, &s_handlerILL
) == 0;
1045 ok
&= sigaction(SIGBUS
, &act
, &s_handlerBUS
) == 0;
1046 ok
&= sigaction(SIGSEGV
, &act
, &s_handlerSEGV
) == 0;
1049 wxLogDebug(_T("Failed to install our signal handler."));
1052 s_savedHandlers
= TRUE
;
1054 else if ( s_savedHandlers
)
1056 // uninstall the signal handler
1057 ok
&= sigaction(SIGFPE
, &s_handlerFPE
, NULL
) == 0;
1058 ok
&= sigaction(SIGILL
, &s_handlerILL
, NULL
) == 0;
1059 ok
&= sigaction(SIGBUS
, &s_handlerBUS
, NULL
) == 0;
1060 ok
&= sigaction(SIGSEGV
, &s_handlerSEGV
, NULL
) == 0;
1063 wxLogDebug(_T("Failed to uninstall our signal handler."));
1066 s_savedHandlers
= FALSE
;
1068 //else: nothing to do
1073 #endif // wxUSE_ON_FATAL_EXCEPTION
1075 // ----------------------------------------------------------------------------
1076 // error and debug output routines (deprecated, use wxLog)
1077 // ----------------------------------------------------------------------------
1079 void wxDebugMsg( const char *format
, ... )
1082 va_start( ap
, format
);
1083 vfprintf( stderr
, format
, ap
);
1088 void wxError( const wxString
&msg
, const wxString
&title
)
1090 wxFprintf( stderr
, _("Error ") );
1091 if (!title
.IsNull()) wxFprintf( stderr
, wxT("%s "), WXSTRINGCAST(title
) );
1092 if (!msg
.IsNull()) wxFprintf( stderr
, wxT(": %s"), WXSTRINGCAST(msg
) );
1093 wxFprintf( stderr
, wxT(".\n") );
1096 void wxFatalError( const wxString
&msg
, const wxString
&title
)
1098 wxFprintf( stderr
, _("Error ") );
1099 if (!title
.IsNull()) wxFprintf( stderr
, wxT("%s "), WXSTRINGCAST(title
) );
1100 if (!msg
.IsNull()) wxFprintf( stderr
, wxT(": %s"), WXSTRINGCAST(msg
) );
1101 wxFprintf( stderr
, wxT(".\n") );
1102 exit(3); // the same exit code as for abort()