#include <string.h>\r
#include <net.h>\r
#include <readline.h>\r
+#include <acess/devices/pty.h>\r
\r
// === TYPES ===\r
typedef struct sServer {\r
\r
atexit(ExitHandler);\r
\r
- giTerminal_Width = _SysIOCtl(1, 5, NULL); // getset_width\r
- giTerminal_Height = _SysIOCtl(1, 6, NULL); // getset_height\r
+ if( _SysIOCtl(1, DRV_IOCTL_TYPE, NULL) != DRV_TYPE_TERMINAL ) {\r
+ printf(stderr, "note: assuming 80x25, can't get terminal dimensions\n");\r
+ giTerminal_Width = 80;\r
+ giTerminal_Height = 25;\r
+ }\r
+ else {\r
+ struct ptydims dims;\r
+ _SysIOCtl(1, PTY_IOCTL_GETDIMS, &dims);\r
+ giTerminal_Width = dims.W;\r
+ giTerminal_Height = dims.H;\r
+ }\r
\r
printf("\x1B[?1047h");\r
printf("\x1B[%i;%ir", 0, giTerminal_Height-1);\r