From: John Hodge Date: Tue, 6 Aug 2013 01:55:26 +0000 (+0800) Subject: Usermode/IRC - Added basic PTY support X-Git-Tag: rel0.15~293 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=733b37c90c20a76ec81c04431e8bc5224f053e28;p=tpg%2Facess2.git Usermode/IRC - Added basic PTY support --- diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index b96fcc9e..a348277a 100644 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -7,6 +7,7 @@ #include #include #include +#include // === TYPES === typedef struct sServer { @@ -102,8 +103,17 @@ int main(int argc, const char *argv[], const char *envp[]) atexit(ExitHandler); - giTerminal_Width = _SysIOCtl(1, 5, NULL); // getset_width - giTerminal_Height = _SysIOCtl(1, 6, NULL); // getset_height + if( _SysIOCtl(1, DRV_IOCTL_TYPE, NULL) != DRV_TYPE_TERMINAL ) { + printf(stderr, "note: assuming 80x25, can't get terminal dimensions\n"); + giTerminal_Width = 80; + giTerminal_Height = 25; + } + else { + struct ptydims dims; + _SysIOCtl(1, PTY_IOCTL_GETDIMS, &dims); + giTerminal_Width = dims.W; + giTerminal_Height = dims.H; + } printf("\x1B[?1047h"); printf("\x1B[%i;%ir", 0, giTerminal_Height-1);