diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2011-09-03 14:05:25 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2011-09-03 14:05:25 +0200 |
commit | 9d943c7539f59f42ba8f8052497dc541fe5f0167 (patch) | |
tree | c8725127bf7a68d3d7fe57adca45c204b25adf21 /pty.c | |
parent | 0e9a09d7718f02726b12924f7ddb05a992202aa3 (diff) | |
download | screen-9d943c7539f59f42ba8f8052497dc541fe5f0167.tar.gz |
Imported Upstream version 4.0.2upstream/4.0.2
Diffstat (limited to 'pty.c')
-rw-r--r-- | pty.c | 42 |
1 files changed, 28 insertions, 14 deletions
@@ -21,9 +21,6 @@ **************************************************************** */ -#include "rcs.h" -RCS_ID("$Id: pty.c,v 1.6 1994/05/31 12:32:44 mlschroe Exp $ FAU") - #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -94,6 +91,14 @@ static char TtyProto[] = "/dev/ttyXY"; static void initmaster __P((int)); +#if defined(sun) +/* sun's utmp_update program opens the salve side, thus corrupting + */ +int pty_preopen = 1; +#else +int pty_preopen = 0; +#endif + /* * Open all ptys with O_NOCTTY, just to be on the safe side * (RISCos mips breaks otherwise) @@ -281,10 +286,6 @@ char **ttyn; #if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) #define PTY_DONE -#ifdef _IBMR2 -int aixhack = -1; -#endif - int OpenPTY(ttyn) char **ttyn; @@ -303,13 +304,7 @@ char **ttyn; } initmaster(f); # ifdef _IBMR2 - if (aixhack >= 0) - close(aixhack); - if ((aixhack = open(TtyName, O_RDWR | O_NOCTTY)) < 0) - { - close(f); - return -1; - } + pty_preopen = 1; # endif *ttyn = TtyName; return f; @@ -318,6 +313,25 @@ char **ttyn; /***************************************************************/ +#if defined(HAVE_OPENPTY) && !defined(PTY_DONE) +#define PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + int f, s; + if (openpty(&f, &s, TtyName, NULL, NULL) != 0) + return -1; + close(s); + initmaster(f); + pty_preopen = 1; + *ttyn = TtyName; + return f; +} +#endif + +/***************************************************************/ + #ifndef PTY_DONE int OpenPTY(ttyn) |