#include <stdlib.h>
#include <string>
#include <vector>
-#if defined(_WIN32) || defined(__CYGWIN__)
-#include <windows.h>
-#endif
using namespace std;
using namespace lyx::support;
exit(0);
}
-
-#if defined(_WIN32) || defined(__CYGWIN__)
-BOOL terminate_handler(DWORD event)
-{
- if (event == CTRL_CLOSE_EVENT
- || event == CTRL_LOGOFF_EVENT
- || event == CTRL_SHUTDOWN_EVENT)
- raise(SIGTERM);
- return FALSE;
-}
-#endif
-
}
signal(SIGINT, error_handler);
signal(SIGTERM, error_handler);
// SIGPIPE can be safely ignored.
-#if defined(_WIN32) || defined(__CYGWIN__)
- // On Windows we have also to catch logging off or closing the console.
- SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, TRUE);
-#endif
lyxrc.tempdir_path = package().temp_dir().absFilename();
lyxrc.document_path = package().document_dir().absFilename();
return subst(p, '\\', '/');
}
+
+BOOL terminate_handler(DWORD event)
+{
+ if (event == CTRL_CLOSE_EVENT
+ || event == CTRL_LOGOFF_EVENT
+ || event == CTRL_SHUTDOWN_EVENT) {
+ ::raise(SIGTERM);
+ // Relinquish our time slice.
+ sleep(0);
+ return TRUE;
+ }
+ return FALSE;
+}
+
} // namespace anon
void init(int, char *[])
{
// Make sure that the TEMP variable is set
// and sync the Windows environment.
-
setenv("TEMP", "/tmp", false);
cygwin_internal(CW_SYNC_WINENV);
+
+ // Catch shutdown events.
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, TRUE);
}
#include "support/lassert.h"
+#include <csignal>
#include <cstdlib>
#include <vector>
string cygdrive = "/cygdrive";
+BOOL terminate_handler(DWORD event)
+{
+ if (event == CTRL_CLOSE_EVENT
+ || event == CTRL_LOGOFF_EVENT
+ || event == CTRL_SHUTDOWN_EVENT) {
+ ::raise(SIGTERM);
+ // Relinquish our time slice.
+ Sleep(0);
+ return TRUE;
+ }
+ return FALSE;
+}
+
} // namespace anon
void init(int /* argc */, char * argv[])
if ((retVal == ERROR_SUCCESS) && (bufSize <= MAX_PATH))
cygdrive = rtrim(string(buf), "/");
}
+
+ // Catch shutdown events.
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)terminate_handler, TRUE);
}