X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e99f815328a471c30fb51700917775a872dd65a..b3887715e49225f7022858586dae58c0bee53180:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index b372b21c34..fbeb877d03 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -290,6 +290,29 @@ bool wxShell(const wxString& command, wxArrayString& output) return wxExecute(wxMakeShellCommand(command), output); } +// Shutdown or reboot the PC +bool wxShutdown(wxShutdownFlags wFlags) +{ + wxChar level; + switch ( wFlags ) + { + case wxSHUTDOWN_POWEROFF: + level = _T('0'); + break; + + case wxSHUTDOWN_REBOOT: + level = _T('6'); + break; + + default: + wxFAIL_MSG( _T("unknown wxShutdown() flag") ); + return FALSE; + } + + return system(wxString::Format(_T("init %c"), level).mb_str()) == 0; +} + + #if wxUSE_GUI void wxHandleProcessTermination(wxEndProcessData *proc_data)