From 0543208957f3f1a14f66d0c70fcc813e779f7638 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 26 Sep 2010 20:32:34 +0200 Subject: Working login, buggy terminal-data reception --- console.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 console.c (limited to 'console.c') diff --git a/console.c b/console.c new file mode 100644 index 0000000..558184f --- /dev/null +++ b/console.c @@ -0,0 +1,21 @@ +#include +#include +#include +#include +#include + +int getTerminalSize(unsigned short *width, unsigned short *height) { + struct winsize ws; + + if (ioctl(0,TIOCGWINSZ,&ws) != 0) { + fprintf(stderr,"TIOCGWINSZ:%s\n",strerror(errno)); + return -1; + } + + *width = ws.ws_col; + *height = ws.ws_row; + + printf("Console width: %d, height: %d\n", *width, *height); + + return 1; +} -- cgit v1.2.3