mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
added pinvoke functions to query terminal size
This commit is contained in:
1 parent
1b02619b2d
commit
39e939ce0f
4 files changed
+34
-1
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "pal.h"
|
||||
|
||||
PAL_BEGIN_EXTERNC
|
||||
|
||||
INT32 GetTerminalWidth();
|
||||
INT32 GetTerminalHeight();
|
||||
|
||||
PAL_END_EXTERNC
|
||||
|
||||
Reference in new issue
Block a user