annotate src/systty.h @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 376386a54a3c
children 85ec50267440
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* systty.h - System-dependent definitions for terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.30. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #ifndef _XEMACS_SYSTTY_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #define _XEMACS_SYSTTY_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #ifdef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 # define HAVE_TCATTR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 /* If we defined these before and we are about to redefine them,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 prevent alarming warnings. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #ifdef BSD_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #undef NL0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #undef NL1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #undef CR0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #undef CR1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #undef CR2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #undef CR3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #undef TAB0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #undef TAB1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #undef TAB2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #undef XTABS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #undef BS0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #undef BS1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #undef FF0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 #undef FF1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 #undef ECHO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 #undef NOFLSH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 #undef TOSTOP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 #undef FLUSHO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 #undef PENDIN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 /* Include the proper files. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 /* XEmacs: TERMIOS is mo' better than TERMIO so we use it if it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 there. Since TERMIO is backward-compatibility stuff if both it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 and TERMIOS exist, it's more likely to be broken. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 #if defined (HAVE_TERMIOS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 /***** (1) The TERMIOS way (POSIX style) *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 # if defined (_AIX) && defined (_I386)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 # include <termios.h> /* termios.h needs to be before termio.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 # include <termio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 # if !defined (NO_TERMIO)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 # include <termio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 # include <termios.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 # endif /* _AIX && _I386 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 # ifndef INCLUDED_FCNTL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 # define INCLUDED_FCNTL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 # include <fcntl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 #elif defined (HAVE_TERMIO)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 /***** (2) The TERMIO way (system V style) *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 # ifdef __DGUX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 # include <sys/ioctl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 # ifndef NO_TERMIO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 # include <termio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 # endif /* not NO_TERMIO */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 # ifndef INCLUDED_FCNTL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 # define INCLUDED_FCNTL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 # include <fcntl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 #elif defined (DOS_NT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 /***** (3) The MSDOS/NT way *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 /* Nothing doing */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 #elif !defined (VMS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 /***** (4) The BSD way *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 # ifdef linux /* XEmacs addition -- necessary? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 # include <bsd/sgtty.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 # include <sgtty.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 #else /* VMS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 /***** (5) The VMS way *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 # include <descrip.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 static struct iosb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 short status;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 short offset;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 short termlen;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 short term;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 } input_iosb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 extern int vms_waiting_for_ast;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 extern int vms_stop_input;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 extern int vms_input_ef;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 extern int vms_timer_ef;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 extern int vms_process_ef;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 extern int vms_input_eflist;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 extern int vms_timer_eflist;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 static $DESCRIPTOR (vms_input_dsc, "TT");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 static int vms_terminator_mask[2] = { 0, 0 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 static struct sensemode {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 short status;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 unsigned char xmit_baud;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 unsigned char rcv_baud;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 unsigned char crfill;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 unsigned char lffill;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 unsigned char parity;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 unsigned char unused;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 char class;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 char type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 short scr_wid;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 unsigned long tt_char : 24, scr_len : 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 unsigned long tt2_char;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 } sensemode_iosb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 #endif /* VMS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 /* XEmacs: I don't think we need the following crap. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 #ifdef __GNU_LIBRARY__
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 #include <termios.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 /* Formerly there was a conditional that included sys/filio.h if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 USG5_4 was defined, but this is already included in s/usg5-4.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 /* Generally useful to include this file: */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 /* But Sun OS has broken include files and doesn't want it included */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 #if !defined (VMS) && !defined (DOS_NT) && !defined (WIN32) && !defined (SUNOS4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 # include <sys/ioctl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 /* UNIPLUS systems may have FIONREAD. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 #ifdef UNIPLUS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 #include <sys.ioctl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 /* miscellaneous includes */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 #ifdef AIXHFT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 /* Get files for keyboard remapping */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 #define HFNKEYS 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 #include <sys/hft.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 #include <sys/devinfo.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 /* XEmacs: We don't support BSD 4.1 any more */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 #ifdef NEED_BSDTTY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 #include <sys/bsdtty.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 /* Include files for PTY's */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 #if defined (HPUX) && defined (HAVE_PTYS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 #include <sys/ptyio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 #ifdef AIX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 #include <sys/pty.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 #endif /* AIX */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 /* XEmacs: We don't include unistd.h because it's done in lisp.h */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 #ifdef SYSV_PTYS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 # include <sys/types.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 # include <sys/tty.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 # ifdef titan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 # include <sys/ttyhw.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 # include <sys/stream.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 # ifndef NO_PTY_H
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 # include <sys/pty.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 /* XEmacs: removed some random if defined (pfa) crap for FASYNC (SIGIO).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 We've cleaned SIGIO up. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 /* inhibiting particular features */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 #ifdef APOLLO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 #undef TIOCSTART
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 #if defined (XENIX) || defined (BROKEN_TIOCGETC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 #undef TIOCGETC /* Avoid confusing some conditionals that test this. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 /* XEmacs: SIGIO is cleaned up so we remove the crap here that messes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 with it (and FIONREAD and FASYNC, which are related). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 #ifdef BROKEN_TIOCGWINSZ /* XEmacs addition */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 #undef TIOCGWINSZ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 #undef TIOCSWINSZ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 #ifdef BROKEN_O_NONBLOCK /* XEmacs addition */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 # undef O_NONBLOCK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 #endif /* BROKEN_O_NONBLOCK */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 /* On TERMIOS systems, the tcmumbleattr calls take care of these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 parameters, and it's a bad idea to use them (on AIX, it makes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 tty hang for a long time). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 #if defined (TIOCGLTC) && !defined (HAVE_TERMIOS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 #define HAVE_LTCHARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 #if defined (TIOCGETC) && !defined (HAVE_TERMIOS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 #define HAVE_TCHARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 /* disabling terminal functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 /* Try to establish the correct character to disable terminal functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 in a system-independent manner. Note that USG (at least) define
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 _POSIX_VDISABLE as 0! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 #ifdef _POSIX_VDISABLE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 #define CDISABLE _POSIX_VDISABLE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 #else /* not _POSIX_VDISABLE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 #ifdef CDEL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 #undef CDISABLE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 #define CDISABLE CDEL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 #else /* not CDEL */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 #define CDISABLE 255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 #endif /* not CDEL */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 #endif /* not _POSIX_VDISABLE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 /* Get the number of characters queued for output */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 /* ----------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 /* EMACS_OUTQSIZE(FD, int *SIZE) stores the number of characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 queued for output to the terminal FD in *SIZE, if FD is a tty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 Returns -1 if there was an error (i.e. FD is not a tty), 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 otherwise. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 #ifdef TIOCOUTQ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 #define EMACS_OUTQSIZE(fd, size) ioctl (fd, TIOCOUTQ, size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 #ifdef HAVE_TERMIO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 #ifdef TCOUTQ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 #undef EMACS_OUTQSIZE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 #define EMACS_OUTQSIZE(fd, size) ioctl (fd, TCOUTQ, size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 /* -------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 /* Manipulate a terminal's current (foreground) process group */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 /* -------------------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 /* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 controlling process group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 current process group. Return -1 if there is an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 current process group to *PGID. Return -1 if there is an error. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 /* HPUX tty process group stuff doesn't work, says the anonymous voice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 from the past. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 /* But HPUX people say it does, so I've removed it. --ben */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 # ifdef TIOCGPGRP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 # define EMACS_HAVE_TTY_PGRP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 # ifdef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 # define EMACS_HAVE_TTY_PGRP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 #ifdef EMACS_HAVE_TTY_PGRP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 #if defined (HAVE_TERMIOS) && ! defined (BSD_TERMIOS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 /* Resist the urge to insert needless extra parentheses. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp (fd))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 #define EMACS_SET_TTY_PGRP(fd, pgid) tcsetpgrp (fd, *(pgid))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 #elif defined (TIOCSPGRP)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 #define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 #define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 #endif /* EMACS_HAVE_TTY_PGRP */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 #ifndef EMACS_GET_TTY_PGRP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 /* Just ignore this for now and hope for the best */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 #define EMACS_GET_TTY_PGRP(fd, pgid) 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 #define EMACS_SET_TTY_PGRP(fd, pgif) 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 /* XEmacs interim backward-compatibility */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 #define EMACS_GET_TTY_PROCESS_GROUP EMACS_GET_TTY_PGRP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 #define EMACS_SET_TTY_PROCESS_GROUP EMACS_SET_TTY_PGRP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 /* EMACS_GETPGRP (arg) returns the process group of the terminal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 /* USG systems have always used the no-arg form of getpgrp().
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 POSIX also calls for this, and thus some newer BSD systems
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 have this change. Older BSD systems have an argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 It would be nice to autodetect this, but there's unfortunately
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 no general way. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
353 /* The above comment is crap, because AC_FUNC_GETPGRP provides just
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
354 such a way - mrb. */
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
355
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
356 #if 0 /* mrb */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 /* XEmacs backwards-compatibility */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 #ifdef GETPGRP_NEEDS_ARG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 # undef GETPGRP_NO_ARG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 # ifdef GETPGRP_NO_ARG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 # undef GETPGRP_NEEDS_ARG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 #if defined (USG) && !defined (GETPGRP_NEEDS_ARG)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 # if !defined (GETPGRP_NO_ARG)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 # define GETPGRP_NO_ARG
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 #endif
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
371 #endif /* 0 */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
373 #ifdef GETPGRP_VOID
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
374 #define EMACS_GETPGRP(x) getpgrp()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 #else
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
376 #define EMACS_GETPGRP(x) getpgrp(x)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 0
diff changeset
377 #endif /* GETPGRP_VOID */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 /* XEmacs backward-compatibility. Is 0 always a reasonable argument? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 #define EMACS_GET_PROCESS_GROUP() EMACS_GETPGRP (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 /* Xemacs addition? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 /* EMACS_SEPARATE_PROCESS_GROUP () creates a separate process group for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 running process. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 /* EMACS_SET_PROCESS_GROUP () sets our process group as specified. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 /* POSIX calls for setpgid(), so we use it if it's available.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 Otherwise use setpgrp(), in USG or BSD flavor. Note that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 on newer systems, setpgrp() has unwanted effects (e.g.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 creating a new session), so we want to avoid its use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 if possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 NOTE: On some older systems, we should consider using setpgrp2()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 if it exists. This is sufficiently rare, though, that there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 seems no point in autodetecting it. Currently dgux.h is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 only place where this has to be munged. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 #if defined (HAVE_SETPGID)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 # define EMACS_SEPARATE_PROCESS_GROUP() setpgid (0, 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 # define EMACS_SET_PROCESS_GROUP(pg) setpgid (0, pg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 #elif defined (USG)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 /* old (pre-SVR4) USG's don't provide any way to do this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 No big loss -- it just means that ^Z won't work right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 if we're run from sh. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 # define EMACS_SET_PROCESS_GROUP(pg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 /* Under NeXTstep, a process group of 0 is not the same as specifying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 your own process ID, so we go ahead and specify it explicitly. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 # define EMACS_SEPARATE_PROCESS_GROUP() setpgrp (0, getpid ())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 # define EMACS_SET_PROCESS_GROUP(pg) setpgrp (0, pg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 /* --------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 /* Manipulate a TTY's input/output processing parameters */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 /* --------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 /* struct emacs_tty is a structure used to hold the current tty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 parameters. If the terminal has several structures describing its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 state, for example a struct tchars, a struct sgttyb, a struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 tchars, a struct ltchars, and a struct pagechars, struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 emacs_tty should contain an element for each parameter struct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 that Emacs may change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 EMACS_GET_TTY (int FD, struct emacs_tty *P) stores the parameters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 of the tty on FD in *P. Return zero if all's well, or -1 if we ran
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 into an error we couldn't deal with.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 EMACS_SET_TTY (int FD, struct emacs_tty *P, int flushp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 sets the parameters of the tty on FD according to the contents of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 *P. If flushp is non-zero, we discard queued input to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 written before making the change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 Return 0 if all went well, and -1 if anything failed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 EMACS_TTY_TABS_OK (struct emacs_tty *P) is false iff the kernel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 expands tabs to spaces upon output; in that case, there is no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 advantage to using tabs over spaces. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 /* For each tty parameter structure that Emacs might want to save and restore,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 - include an element for it in this structure, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 - extend the emacs_{get,set}_tty functions in sysdep.c to deal with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 new members. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 struct emacs_tty {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 /* There is always one of the following elements, so there is no need
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 for dummy get and set definitions. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 #ifdef HAVE_TCATTR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 struct termios main;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 #ifdef HAVE_TERMIO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 struct termio main;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 #ifdef VMS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 struct sensemode main;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 #ifdef DOS_NT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 int main;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 #else /* not DOS_NT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 struct sgttyb main;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 #endif /* not DOS_NT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 #endif /* !VMS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 /* If we have TERMIOS, we don't need to do this - they're taken care of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 by the tc*attr calls. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 #ifndef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 #ifdef HAVE_LTCHARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 struct ltchars ltchars;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 #ifdef HAVE_TCHARS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 struct tchars tchars;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 int lmode;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 /* Define EMACS_GET_TTY and EMACS_SET_TTY,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 the macros for reading and setting parts of `struct emacs_tty'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 These got pretty unmanageable (huge macros are hard to debug), and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 finally needed some code which couldn't be done as part of an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 expression, so we moved them out to their own functions in sysdep.c. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 #define EMACS_GET_TTY(fd, p) emacs_get_tty (fd, p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 #define EMACS_SET_TTY(fd, p, waitp) emacs_set_tty (fd, p, waitp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 /* --------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 /* Define EMACS_TTY_TABS_OK */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 /* --------------------------------------------------------- */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 #ifdef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 #ifdef TABDLY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 #define EMACS_TTY_TABS_OK(p) 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 #else /* not def HAVE_TERMIOS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 #ifdef HAVE_TERMIO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 #define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 #else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 #ifdef VMS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 #define EMACS_TTY_TABS_OK(p) (((p)->main.tt_char & TT$M_MECHTAB) != 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 #ifdef DOS_NT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 #define EMACS_TTY_TABS_OK(p) 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 #else /* not DOS_NT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 #define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 #endif /* not DOS_NT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 #endif /* not def VMS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 #endif /* not def HAVE_TERMIO */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 #endif /* not def HAVE_TERMIOS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 #endif /* _XEMACS_SYSTTY_H_ */