summaryrefslogtreecommitdiffstats
path: root/Source/CursesDialog/cmCursesForm.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CursesDialog/cmCursesForm.cxx')
-rw-r--r--Source/CursesDialog/cmCursesForm.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index 0c32964..ef36b45 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -2,7 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCursesForm.h"
-#include <unistd.h>
+#include <cstdlib>
+#ifndef _WIN32
+# include <unistd.h>
+#endif // _WIN32
cmsys::ofstream cmCursesForm::DebugFile;
bool cmCursesForm::Debug = false;
@@ -51,8 +54,12 @@ void cmCursesForm::HandleResize()
endwin();
if (initscr() == nullptr) {
static const char errmsg[] = "Error: ncurses initialization failed\n";
+#ifdef _WIN32
+ fprintf(stderr, "%s", errmsg);
+#else
auto r = write(STDERR_FILENO, errmsg, sizeof(errmsg) - 1);
static_cast<void>(r);
+#endif // _WIN32
exit(1);
}
noecho(); /* Echo off */