]> git.ipfire.org Git - thirdparty/bash.git/blob - include/shtty.h
Imported from ../bash-2.04.tar.gz.
[thirdparty/bash.git] / include / shtty.h
1 /* Copyright (C) 1999 Free Software Foundation, Inc.
2
3 /* This file is part of GNU Bash, the Bourne Again SHell.
4
5 Bash is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version.
9
10 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with Bash; see the file COPYING. If not, write to the Free Software
17 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
18
19 /*
20 * shtty.h -- include the correct system-dependent files to manipulate the
21 * tty
22 */
23
24 #ifndef __SH_TTY_H_
25 #define __SH_TTY_H_
26
27 #include "stdc.h"
28
29 #if defined (_POSIX_VERSION) && defined (HAVE_TERMIOS_H) && defined (HAVE_TCGETATTR) && !defined (TERMIOS_MISSING)
30 # define TERMIOS_TTY_DRIVER
31 #else
32 # if defined (HAVE_TERMIO_H)
33 # define TERMIO_TTY_DRIVER
34 # else
35 # define NEW_TTY_DRIVER
36 # endif
37 #endif
38
39 /*
40 * The _POSIX_SOURCE define is to avoid multiple symbol definitions
41 * between sys/ioctl.h and termios.h. Ditto for the test against SunOS4
42 * and the undefining of several symbols.
43 */
44
45 #ifdef TERMIOS_TTY_DRIVER
46 # if (defined (SunOS4) || defined (SunOS5)) && !defined (_POSIX_SOURCE)
47 # define _POSIX_SOURCE
48 # endif
49 # if defined (SunOS4)
50 # undef ECHO
51 # undef NOFLSH
52 # undef TOSTOP
53 # endif /* SunOS4 */
54 # include <termios.h>
55 # define TTYSTRUCT struct termios
56 #else
57 # ifdef TERMIO_TTY_DRIVER
58 # include <termio.h>
59 # define TTYSTRUCT struct termio
60 # else /* NEW_TTY_DRIVER */
61 # include <sgtty.h>
62 # define TTYSTRUCT struct sgttyb
63 # endif
64 #endif
65
66 /* Functions imported from lib/sh/shtty.c */
67
68 /* Get and set terminal attributes for the file descriptor passed as
69 an argument. */
70 extern int ttgetattr __P((int, TTYSTRUCT *));
71 extern int ttsetattr __P((int, TTYSTRUCT *));
72
73 /* Save and restore the terminal's attributes from static storage. */
74 extern void ttsave __P((void));
75 extern void ttrestore __P((void));
76
77 /* Return the attributes corresponding to the file descriptor (0 or 1)
78 passed as an argument. */
79 extern TTYSTRUCT *ttattr __P((int));
80
81 /* These functions only operate on the passed TTYSTRUCT; they don't
82 actually change anything with the kernel's current tty settings. */
83 extern int tt_setonechar __P((TTYSTRUCT *));
84 extern int tt_setnoecho __P((TTYSTRUCT *));
85 extern int tt_seteightbit __P((TTYSTRUCT *));
86 extern int tt_setnocanon __P((TTYSTRUCT *));
87 extern int tt_setcbreak __P((TTYSTRUCT *));
88
89 /* These functions are all generally mutually exclusive. If you call
90 more than one (bracketed with calls to ttsave and ttrestore, of
91 course), the right thing will happen, but more system calls will be
92 executed than absolutely necessary. You can do all of this yourself
93 with the other functions; these are only conveniences. */
94 extern int ttonechar __P((void));
95 extern int ttnoecho __P((void));
96 extern int tteightbit __P((void));
97 extern int ttnocanon __P((void));
98
99 extern int ttcbreak __P((void));
100
101 #endif