aboutsummaryrefslogtreecommitdiff
path: root/tools/driver/Platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/driver/Platform.cpp')
-rw-r--r--tools/driver/Platform.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/driver/Platform.cpp b/tools/driver/Platform.cpp
index 5b5286e68114..a49161540872 100644
--- a/tools/driver/Platform.cpp
+++ b/tools/driver/Platform.cpp
@@ -8,17 +8,14 @@
//===----------------------------------------------------------------------===//
// this file is only relevant for Visual C++
-#if defined( _MSC_VER )
+#if defined( _WIN32 )
#include <process.h>
#include <assert.h>
+#include <stdlib.h>
#include "Platform.h"
-// index one of the variable arguments
-// presuming "(EditLine *el, ..." is first in the argument list
-#define GETARG( Y, X ) ( (void* ) *( ( (int**) &(Y) ) + (X) ) )
-
// the control handler or SIGINT handler
static sighandler_t _ctrlHandler = NULL;
@@ -42,14 +39,16 @@ ioctl (int d, int request, ...)
// request the console windows size
case ( TIOCGWINSZ ):
{
- // locate the window size structure on stack
- winsize *ws = (winsize*) GETARG( d, 2 );
+ va_list vl;
+ va_start(vl,request);
+ // locate the window size structure on stack
+ winsize *ws = va_arg(vl, winsize*);
// get screen buffer information
CONSOLE_SCREEN_BUFFER_INFO info;
- GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &info );
- // fill in the columns
- ws->ws_col = info.dwMaximumWindowSize.X;
- //
+ if ( GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &info ) == TRUE )
+ // fill in the columns
+ ws->ws_col = info.dwMaximumWindowSize.X;
+ va_end(vl);
return 0;
}
break;
@@ -85,6 +84,7 @@ tcgetattr (int fildes, struct termios *termios_p)
return -1;
}
+#ifdef _MSC_VER
sighandler_t
signal (int sig, sighandler_t sigFunc)
{
@@ -107,5 +107,6 @@ signal (int sig, sighandler_t sigFunc)
}
return 0;
}
+#endif
-#endif \ No newline at end of file
+#endif