DEFINITION MODULE FOR "C" ioctl ;

EXPORT UNQUALIFIED ioctl, TIOCSWINSZ, TIOCGWINSZ, winsizePtr, winsize ;

(* 
#define TIOCGWINSZ	0x5413
#define TIOCSWINSZ	0x5414

int ioctl(int fd, TIOCGWINSZ, struct winsize *argp);
int ioctl(int fd, TIOCSWINSZ, const struct winsize *argp);

       struct winsize {
           unsigned short ws_row;
           unsigned short ws_col;
           unsigned short ws_xpixel;  /* unused */
           unsigned short ws_ypixel;  /* unused */
       };

       TIOCGWINSZ
              Get window size.
       TIOCSWINSZ
              Set window size.

       When the window size changes, a SIGWINCH signal is sent to the
       foreground process group. 

On success, 0 is returned.  On error, -1 is returned, and errno is
set to indicate the error.
*)

TYPE
    winsize =   RECORD
                    ws_row      : CARDINAL;
                    ws_col      : CARDINAL;
                    ws_xpixel   : CARDINAL; (* unused*)
                    ws_ypixel   : CARDINAL; (* unused*)
                END;
    winsizePtr = POINTER TO winsize;

CONST
    TIOCGWINSZ = 5413H;
    TIOCSWINSZ = 5414H;

PROCEDURE ioctl (fd : INTEGER; mode : INTEGER; wptr : winsizePtr) : [ INTEGER ] ;

END ioctl.