/************************************************************************ * This program is Copyright (C) 1986 by Jonathan Payne. JOVE is * * provided to you without charge, and with no warranty. You may give * * away copies of JOVE, including sources, provided that this notice is * * included in all the files. * ************************************************************************/ /*+++* * title: tty.h * abstract: system dependent tty definitions for JOVE * author: T.R.Hageman, Groningen, The Netherlands. * created: july 1990 * description: *---*/ #ifndef _TTY_H_ #define _TTY_H_ #ifndef TUNED # include "tune.h" #endif #ifdef Extern RCS_H(tty, "$Id: tty.h,v 14.31.0.9 1994/01/31 17:30:37 tom Exp tom $") #endif #ifndef Extern /* tty.c sets this to "public" to define the variables */ # define Extern extern #endif #if unix #ifdef TERMIOS # define _I_TERMIOS 1 #endif #if _I_TERMIOS # include # define SGTTYB struct termios # define TERMIOS # ifndef OCRNL # define OCRNL ONLCR # ifndef ONLCR # define ONLCR OPOST # endif # endif # if !__POSIX__ /* some hosts (sun) already support termios, but not yet the Posix access routines. */ # if NeXT && NX_CURRENT_COMPILER_RELEASE <= NX_COMPILER_RELEASE_3_1 /* NS 3.1 already has Posix headers, but not the library routines. (a Bad Move, IMHO). But we can emulate it with ioctl(). */ # undef TCSANOW # undef TCSADRAIN # endif # ifndef TCSANOW # ifdef TCGETS # define tcgetattr(fd, t) ioctl(fd, TCGETS, (t)) # define tcsetattr ioctl # define TCSANOW TCSETS # define TCSADRAIN TCSETSW # else # ifdef TIOCGETA # define tcgetattr(fd, t) ioctl(fd, TIOCGETA, (t)) # define tcsetattr ioctl # define TCSANOW TIOCSETA # define TCSADRAIN TIOCSETAW # else #error "TERMIOS not supported on this system" # endif # endif # ifdef CBAUD # define cfgetospeed(t) ((t)->c_cflag & CBAUD) # define cfsetospeed(t,s) ((t)->c_cflag = \ ((t)->c_cflag & ~CBAUD)|((s) & CBAUD)) # else # define cfgetospeed(t) ((t)->c_ospeed) # define cfsetospeed(t,s) ((t)->c_ospeed = (s)) # endif # endif # endif /* !__POSIX__ */ #else # if _I_TERMIO # include # define SGTTYB struct termio # define TERMIOS /* we emulate TERMIOS */ # define tcgetattr(fd, t) ioctl(fd, TCGETA, (t)) # define tcsetattr ioctl # define TCSANOW TCSETA # define TCSADRAIN TCSETAW # define cfgetospeed(t) ((t)->c_cflag & CBAUD) # ifndef OXTABS # define OXTABS TAB3 # endif # else # include # ifndef TIOCNRD /* Some systems (i.e., NS 3.1) use these to handle struct termios, not the extended 7th ed. struct sgtty I intended... (TIOCNRD seems sufficiently unique to 7th ed to use as safeguard) */ # undef TIOCGETA # undef TIOCSETA # endif # ifdef INWAIT # ifdef DC3DC1 # ifdef STALL # ifdef PAGE # define BRLUNIX /* What weird UNIX dialect is this? */ # endif # endif # endif # endif # ifdef BRLUNIX # define SGTTYB struct sg_brl # else # define SGTTYB struct sgttyb # endif # endif #endif #ifdef TERMIOS # ifdef HAVE_BSDTTY_H # include /* HP-UX cannot disable DSUSP via termios interface. BRAINDAMAGE!!! */ # else # undef TIOCSLTC # undef TIOCGLTC # endif #endif Extern SGTTYB sg[2]; #ifdef TIOCSLTC Extern struct ltchars ls[2]; #endif #ifndef TERMIOS #ifdef TIOCGETC Extern struct tchars tc[2]; #endif #ifdef TIOCLGET Extern int lm[2]; /* local mode; new BSD tty driver */ #endif #endif /* TERMIOS */ extern short ospeed; #ifdef TIOCGWINSZ # ifdef INTERACTIVE # include # else # ifdef SCO_SYSV # include # include /* SCO unix at least */ # endif # endif #else # ifdef BTL_BLIT /* define BSD names in terms of JWIN (whatever) */ # include # define TIOCGWINSZ JWINSIZE # define TIOCSWINSZ JSWINSIZE # define winsize jwinsize # define ws_col bytesx # define ws_row bytesy # endif /* BTL_BLIT */ #endif /* TIOCGWINSZ */ #ifdef SYSV # ifndef NO_TRIV_PROTO extern void setblock __(( int _(fd), int _(on) )); # endif #endif #endif /* unix */ extern int CharsPerSec; /* terminal output speed */ #ifndef CSPEED /* default console speed in chars per sec. */ # define CSPEED 1920 #endif #endif /* _TTY_H_ */ #undef Extern /*====================================================================== * $Log: tty.h,v $ * Revision 14.31.0.9 1994/01/31 17:30:37 tom * reorganize TERMIOS/ltchars handling to accommodate HP-UX braindamage. * * Revision 14.31.0.5 1993/09/02 05:01:38 tom * avoid NS 3.1 Posix (non)support. * * Revision 14.31 1993/02/15 03:04:41 tom * replace TINY with NO_TRIV_PROTO for clarity of intent. * * Revision 14.29 1992/12/30 10:43:34 tom * add cfsetospeed() emulation. * * Revision 14.28 1992/10/27 23:31:10 tom * convert to "port{ansi,defs}.h" conventions; move some system-dependencies * from jove.h to here. * * Revision 14.26 1992/08/26 23:56:49 tom * add RCS directives. * */