1 /* $NetBSD: tty.h,v 1.2 1997/01/12 19:12:25 tls Exp $ */
4 tty.h -- centralized definitions for a variety of terminal interfaces
6 created by DPK, Oct. 1986
8 Rearranged to work with autoconf, added TTY_state, get_tty/set_tty
9 Michael Rendell, May '94
11 last edit: 30-Jul-1987 D A Gwyn
13 /* $NetBSD: tty.h,v 1.2 1997/01/12 19:12:25 tls Exp $ */
15 /* some useful #defines */
20 # define EXTERN extern
21 # define EXTERN_DEFINED
24 /* Don't know of a system on which including sys/ioctl.h with termios.h
25 * causes problems. If there is one, these lines need to be deleted and
26 * aclocal.m4 needs to have stuff un-commented.
28 #ifdef SYS_IOCTL_WITH_TERMIOS
29 # define SYS_IOCTL_WITH_TERMIOS
30 #endif /* SYS_IOCTL_WITH_TERMIOS */
31 #ifdef SYS_IOCTL_WITH_TERMIO
32 # define SYS_IOCTL_WITH_TERMIO
33 #endif /* SYS_IOCTL_WITH_TERMIO */
37 # ifdef SYS_IOCTL_WITH_TERMIOS
38 # if !(defined(sun) && !defined(__svr4__)) /* too many warnings on sunos */
39 /* Need to include sys/ioctl.h on some systems to get the TIOCGWINSZ
40 * stuff (eg, digital unix).
42 # include <sys/ioctl.h>
43 # endif /* !(sun && !__svr4__) */
44 # endif /* SYS_IOCTL_WITH_TERMIOS */
45 typedef struct termios TTY_state
;
49 # ifdef SYS_IOCTL_WITH_TERMIO
50 # include <sys/ioctl.h> /* see comment above in termios stuff */
51 # endif /* SYS_IOCTL_WITH_TERMIO */
52 # if _BSD_SYSV /* BRL UNIX System V emulation */
54 # define TIOCGETD _IOR( 't', 0, int )
55 # define TIOCSETD _IOW( 't', 1, int )
59 # define TIOCSTI _IOW( 't', 114, char )
62 # define TIOCSPGRP _IOW( 't', 118, int )
64 # endif /* _BSD_SYSV */
65 typedef struct termio TTY_state
;
66 # else /* HAVE_TERMIO_H */
67 /* Assume BSD tty stuff. Uses TIOCGETP, TIOCSETN; uses TIOCGATC/TIOCSATC if
68 * available, otherwise it uses TIOCGETC/TIOCSETC (also uses TIOCGLTC/TIOCSLTC
73 # define TIOCSETN TIOCSETP
75 # include <sys/ioctl.h>
84 struct ltchars ltchars
;
85 # endif /* TIOCGLTC */
86 # endif /* TIOCGATC */
88 # endif /* HAVE_TERMIO_H */
89 #endif /* HAVE_TERMIOS_H */
91 /* Flags for set_tty() */
93 #define TF_WAIT 0x01 /* drain output, even it requires sleep() */
94 #define TF_MIPSKLUDGE 0x02 /* kludge to unwedge RISC/os 5.0 tty driver */
96 EXTERN
int tty_fd
I__(-1); /* dup'd tty file descriptor */
97 EXTERN
int tty_devtty
; /* true if tty_fd is from /dev/tty */
98 EXTERN TTY_state tty_state
; /* saved tty state */
100 extern int get_tty
ARGS((int fd
, TTY_state
*ts
));
101 extern int set_tty
ARGS((int fd
, TTY_state
*ts
, int flags
));
102 extern void tty_init
ARGS((int init_ttystate
));
103 extern void tty_close
ARGS((void));
105 /* be sure not to interfere with anyone else's idea about EXTERN */
106 #ifdef EXTERN_DEFINED
107 # undef EXTERN_DEFINED