1 ! Copyright (C) 2012 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: accessors arrays classes.struct io.streams.c kernel
5 math system terminal unix unix.ffi ;
6 QUALIFIED-WITH: alien.c-types c
12 CONSTANT: TIOCGWINSZ 0x5413
18 { ws_ypixel c:short } ;
22 M: unix (terminal-size)
23 stdout-handle fileno TIOCGWINSZ winsize new
24 [ ioctl ] keep swap 0 < [
27 [ ws_col>> ] [ ws_row>> ] bi