1 /* Copyright (c) 2008, 2009
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Micah Cowan (micah@cowan.name)
5 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9 * Copyright (c) 1987 Oliver Laumann
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3, or (at your option)
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING); if not, see
23 * https://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
33 #include <sys/ioctl.h>
37 #if defined(HAVE_PTY_H)
40 #if defined(HAVE_UTIL_H)
43 #if defined(HAVE_LIBUTIL_H)
49 /***************************************************************/
51 int OpenPTY(char **ttyn
)
53 static char TtyName
[32];
56 if (openpty(&f
, &s
, TtyName
, NULL
, NULL
) != 0)
60 tcflush(f
, TCIOFLUSH
);
61 #if defined(LOCKPTY) && defined(TIOCEXCL) && defined(TIOCNXCL)
62 (void)ioctl(f
, TIOCEXCL
, NULL
);
72 #if defined(LOCKPTY) && defined(TIOCEXCL) && defined(TIOCNXCL)
73 (void)ioctl(fd
, TIOCNXCL
, NULL
);