added pinvoke functions to query terminal size

This commit is contained in:
Peter Honeder committed 2015-07-07 18:04:23 -07:00
1 parent 1b02619b2d
commit 39e939ce0f
4 files changed
+34 -1

No files matched your search

+1
View File
@@ -54,6 +54,7 @@
typedef char BOOL;
typedef unsigned short WCHAR_T;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned long HRESULT;
typedef const wchar_t *PCWSTR;
typedef wchar_t *PWSTR;
+21
View File
@@ -0,0 +1,21 @@
#include "terminal.h"
#include <sys/ioctl.h>
INT32 GetTerminalWidth()
{
struct winsize ws;
if (-1 == ioctl(0,TIOCGWINSZ,&ws))
return -1;
return ws.ws_col;
}
INT32 GetTerminalHeight()
{
struct winsize ws;
if (-1 == ioctl(0,TIOCGWINSZ,&ws))
return -1;
return ws.ws_row;
}
+11
View File
@@ -0,0 +1,11 @@
#pragma once
#include "pal.h"
PAL_BEGIN_EXTERNC
INT32 GetTerminalWidth();
INT32 GetTerminalHeight();
PAL_END_EXTERNC