annotate src/pty.c @ 893:bf7803d0f5b9 v7.0.019

updated for version 7.0-019
author vimboss
date Tue, 20 Jun 2006 18:29:34 +0000
parents 3fc0f57ecb91
children d4bc24e6a281
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 * The stuff in this file mostly comes from the "screen" program.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 * Included with permission from Juergen Weigert.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * Copied from "pty.c". "putenv.c" was used for putenv() in misc2.c.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 * It has been modified to work better with Vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 * The parts that are not used in Vim have been deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 * See the "screen" sources for the complete stuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 /* Copyright (c) 1993
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 * Copyright (c) 1987 Oliver Laumann
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 * This program is free software; you can redistribute it and/or modify
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 * it under the terms of the GNU General Public License as published by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 * the Free Software Foundation; either version 2, or (at your option)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 * any later version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 * This program is distributed in the hope that it will be useful,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 * GNU General Public License for more details.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 * You should have received a copy of the GNU General Public License
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 * along with this program (see the file COPYING); if not, write to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 * Free Software Foundation, Inc.,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 /* RCS_ID("$Id$ FAU") */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 #ifdef HAVE_FCNTL_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 # include <fcntl.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 #include <signal.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 #ifdef __CYGWIN32__
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 # include <sys/termios.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 #if HAVE_SYS_IOCTL_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 # include <sys/ioctl.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 #if HAVE_STROPTS_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 #include <sys/types.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 #ifdef sinix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 #define buf_T __system_buf_t__
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 #include <stropts.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 #ifdef sinix
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 #undef buf_T
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 # ifdef sun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 # include <sys/conf.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 #if HAVE_UNISTD_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 # include <unistd.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 #if HAVE_TERMIO_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 # include <termio.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 # if HAVE_TERMIOS_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 # include <termios.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 #if HAVE_SYS_STREAM_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 # include <sys/stream.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 #if HAVE_SYS_PTEM_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 # include <sys/ptem.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 #if !defined(sun) && !defined(VMS) && !defined(MACOS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 # include <sys/ioctl.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 #if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 # include <sys/ttold.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 #ifdef ISC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 # include <sys/tty.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 # include <sys/sioctl.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 # include <sys/pty.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 #ifdef sgi
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 # include <sys/sysmacros.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 #if defined(_INCLUDE_HPUX_SOURCE) && !defined(hpux)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 # define hpux
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 * if no PTYRANGE[01] is in the config file, we pick a default
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 #ifndef PTYRANGE0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 # define PTYRANGE0 "qprs"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 #ifndef PTYRANGE1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 # define PTYRANGE1 "0123456789abcdef"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 /* SVR4 pseudo ttys don't seem to work with SCO-5 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 #ifdef M_UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 # undef HAVE_SVR4_PTYS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 static void initmaster __ARGS((int));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 * Open all ptys with O_NOCTTY, just to be on the safe side
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 * (RISCos mips breaks otherwise)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 #ifndef O_NOCTTY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 # define O_NOCTTY 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 initmaster(f)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 #ifndef VMS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 # ifdef POSIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 tcflush(f, TCIOFLUSH);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 # ifdef TIOCFLUSH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 (void)ioctl(f, TIOCFLUSH, (char *) 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 # ifdef LOCKPTY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 (void)ioctl(f, TIOCEXCL, (char *) 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 * This causes a hang on some systems, but is required for a properly working
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 * pty on others. Needs to be tuned...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 SetupSlavePTY(fd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 int fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 if (fd < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 #if defined(I_PUSH) && defined(HAVE_SVR4_PTYS) && !defined(sgi) && !defined(linux) && !defined(__osf__) && !defined(M_UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 # if defined(HAVE_SYS_PTEM_H) || defined(hpux)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 if (ioctl(fd, I_PUSH, "ptem") != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 if (ioctl(fd, I_PUSH, "ldterm") != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 # ifdef sun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 if (ioctl(fd, I_PUSH, "ttcompat") != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 #if defined(OSX) && !defined(PTY_DONE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 #define PTY_DONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 OpenPTY(ttyn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 char **ttyn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 static char TtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 if ((f = open_controlling_pty(TtyName)) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 initmaster(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 *ttyn = TtyName;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 return f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 #if (defined(sequent) || defined(_SEQUENT_)) && defined(HAVE_GETPSEUDOTTY) \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 && !defined(PTY_DONE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 #define PTY_DONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 OpenPTY(ttyn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 char **ttyn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 char *m, *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 /* used for opening a new pty-pair: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 static char PtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 static char TtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 if ((f = getpseudotty(&s, &m)) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 #ifdef _SEQUENT_
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 fvhangup(s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 strncpy(PtyName, m, sizeof(PtyName));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 strncpy(TtyName, s, sizeof(TtyName));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 initmaster(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 *ttyn = TtyName;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 return f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 #if defined(__sgi) && !defined(PTY_DONE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 #define PTY_DONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 OpenPTY(ttyn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 char **ttyn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 char *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 RETSIGTYPE (*sigcld)__ARGS(SIGPROTOARG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 * SIGCHLD set to SIG_DFL for _getpty() because it may fork() and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 * exec() /usr/adm/mkpts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 sigcld = signal(SIGCHLD, SIG_DFL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 name = _getpty(&f, O_RDWR | O_NONBLOCK | O_EXTRA, 0600, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 signal(SIGCHLD, sigcld);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 if (name == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 initmaster(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 *ttyn = name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 return f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 #if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 #define PTY_DONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 OpenPTY(ttyn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 char **ttyn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 struct stat buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 /* used for opening a new pty-pair: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 static char TtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_NONBLOCK | O_EXTRA, 0)) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 if (mch_fstat(f, &buf) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 close(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 sprintf(TtyName, "/dev/ttyq%d", minor(buf.st_rdev));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 initmaster(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 *ttyn = TtyName;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 return f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 #if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 #define PTY_DONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 OpenPTY(ttyn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 char **ttyn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 char *m, *ptsname();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 int unlockpt __ARGS((int)), grantpt __ARGS((int));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 RETSIGTYPE (*sigcld)__ARGS(SIGPROTOARG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 /* used for opening a new pty-pair: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 static char TtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 if ((f = open("/dev/ptmx", O_RDWR | O_NOCTTY | O_EXTRA, 0)) == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 * SIGCHLD set to SIG_DFL for grantpt() because it fork()s and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 * exec()s pt_chmod
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 sigcld = signal(SIGCHLD, SIG_DFL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 signal(SIGCHLD, sigcld);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 close(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 signal(SIGCHLD, sigcld);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 strncpy(TtyName, m, sizeof(TtyName));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 initmaster(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 *ttyn = TtyName;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 return f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 #if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 #define PTY_DONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 #ifdef _IBMR2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 int aixhack = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 OpenPTY(ttyn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 char **ttyn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 /* used for opening a new pty-pair: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 static char TtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 /* a dumb looking loop replaced by mycrofts code: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 strncpy(TtyName, ttyname(f), sizeof(TtyName));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 if (geteuid() && mch_access(TtyName, R_OK | W_OK))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 close(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 initmaster(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 # ifdef _IBMR2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 if (aixhack >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 close(aixhack);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 if ((aixhack = open(TtyName, O_RDWR | O_NOCTTY | O_EXTRA, 0)) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 close(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 *ttyn = TtyName;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 return f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 #ifndef PTY_DONE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 # ifdef hpux
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 static char PtyProto[] = "/dev/ptym/ptyXY";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 static char TtyProto[] = "/dev/pty/ttyXY";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 # ifdef __BEOS__
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 static char PtyProto[] = "/dev/pt/XY";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 static char TtyProto[] = "/dev/tt/XY";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 static char PtyProto[] = "/dev/ptyXY";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 static char TtyProto[] = "/dev/ttyXY";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 OpenPTY(ttyn)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 char **ttyn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 char *p, *q, *l, *d;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 int f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 /* used for opening a new pty-pair: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 static char PtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 static char TtyName[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 strcpy(PtyName, PtyProto);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 strcpy(TtyName, TtyProto);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 for (p = PtyName; *p != 'X'; p++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 for (q = TtyName; *q != 'X'; q++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 for (l = PTYRANGE0; (*p = *l) != '\0'; l++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 #if !defined(MACOS) || defined(USE_CARBONIZED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 if ((f = open(PtyName, O_RDWR | O_NOCTTY | O_EXTRA, 0)) == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 if ((f = open(PtyName, O_RDWR | O_NOCTTY | O_EXTRA)) == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 q[0] = *l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 q[1] = *d;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 #ifndef MACOS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 if (geteuid() && mch_access(TtyName, R_OK | W_OK))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 close(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 #if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 /* Hack to ensure that the slave side of the pty is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 * unused. May not work in anything other than SunOS4.1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 int pgrp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 /* tcgetpgrp does not work (uses TIOCGETPGRP)! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 close(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 initmaster(f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 *ttyn = TtyName;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 return f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 #endif