FUNCTION: uint htonl ( uint n ) ;
FUNCTION: ushort htons ( ushort n ) ;
! FUNCTION: int issetugid ;
+FUNCTION: int isatty ( int fildes ) ;
FUNCTION: int ioctl ( int fd, ulong request, char* argp ) ;
FUNCTION: int lchown ( char* path, uid_t owner, gid_t group ) ;
FUNCTION: int listen ( int s, int backlog ) ;
combinators continuations destructors fry io.encodings.8-bit
io io.encodings.string io.encodings.utf8 kernel locals math
namespaces prettyprint sequences classes.struct
-strings threads curses.ffi ;
+strings threads curses.ffi unix.ffi ;
IN: curses
SYMBOL: curses-windows
ERROR: unnamed-window window ;
ERROR: window-not-found window ;
ERROR: curses-failed ;
+ERROR: unsupported-curses-terminal ;
: get-window ( string -- window )
dup curses-windows get at*
: curses-error ( n -- ) ERR = [ curses-failed ] when ;
+: curses-ok? ( -- ? )
+ { 0 1 2 } [ isatty 0 = not ] all? ;
+
: with-curses ( quot -- )
+ curses-ok? [ unsupported-curses-terminal ] unless
H{ } clone curses-windows [
initscr curses-error
[