+ case DRV_TYPE_TERMINAL:
+ switch(request)
+ {
+ case TIOCGWINSZ: {
+ struct winsize *ws = va_arg(args, struct winsize*);
+ _SysDebug("ioctl(%i, TIOCGWINSZ, %p", fd, ws);
+ struct ptydims dims;
+ _SysIOCtl(fd, PTY_IOCTL_GETDIMS, &dims);
+ ws->ws_col = dims.W;
+ ws->ws_row = dims.H;
+ ws->ws_xpixel = dims.PW;
+ ws->ws_ypixel = dims.PH;
+ return 0; }
+ case TIOCSWINSZ: {
+ const struct winsize *ws = va_arg(args, const struct winsize*);
+ _SysDebug("ioctl(%i, TIOCSWINSZ, %p", fd, ws);
+ struct ptydims dims;
+ dims.W = ws->ws_col;
+ dims.H = ws->ws_row;
+ dims.PW = ws->ws_xpixel;
+ dims.PH = ws->ws_ypixel;
+ _SysIOCtl(fd, PTY_IOCTL_SETDIMS, &dims);
+ return 0; }
+ default:
+ _SysDebug("ioctl(%i, TIOC? %i, ...)", fd, request);
+ break;
+ }
+ return -1;