summaryrefslogtreecommitdiff
path: root/pty.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2011-09-03 14:05:24 +0200
committerAxel Beckert <abe@deuxchevaux.org>2011-09-03 14:05:24 +0200
commit0e9a09d7718f02726b12924f7ddb05a992202aa3 (patch)
tree7b78a28379fdbe3a9dba37cd99c780c5d42c1e6c /pty.c
parentbdf45bc45637eefdbdee913465729f9d31d6c255 (diff)
downloadscreen-0e9a09d7718f02726b12924f7ddb05a992202aa3.tar.gz
Imported Upstream version 3.9.11upstream/3.9.11
Diffstat (limited to 'pty.c')
-rw-r--r--pty.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/pty.c b/pty.c
index 69d4355..e9f19a0 100644
--- a/pty.c
+++ b/pty.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -121,19 +121,19 @@ int f;
}
void
-InitPty(f)
+InitPTY(f)
int f;
{
if (f < 0)
return;
#if defined(I_PUSH) && defined(HAVE_SVR4_PTYS) && !defined(sgi) && !defined(linux) && !defined(__osf__) && !defined(M_UNIX)
if (ioctl(f, I_PUSH, "ptem"))
- Panic(errno, "InitPty: cannot I_PUSH ptem");
+ Panic(errno, "InitPTY: cannot I_PUSH ptem");
if (ioctl(f, I_PUSH, "ldterm"))
- Panic(errno, "InitPty: cannot I_PUSH ldterm");
+ Panic(errno, "InitPTY: cannot I_PUSH ldterm");
# ifdef sun
if (ioctl(f, I_PUSH, "ttcompat"))
- Panic(errno, "InitPty: cannot I_PUSH ttcompat");
+ Panic(errno, "InitPTY: cannot I_PUSH ttcompat");
# endif
#endif
}
@@ -152,6 +152,7 @@ char **ttyn;
initmaster(f);
*ttyn = TtyName;
return f;
+}
#endif
/***************************************************************/
@@ -243,10 +244,17 @@ char **ttyn;
register int f;
char *m, *ptsname();
int unlockpt __P((int)), grantpt __P((int));
+#if defined(HAVE_GETPT) && defined(linux)
+ int getpt __P((void));
+#endif
sigret_t (*sigcld)__P(SIGPROTOARG);
strcpy(PtyName, "/dev/ptmx");
+#if defined(HAVE_GETPT) && defined(linux)
+ if ((f = getpt()) == -1)
+#else
if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
+#endif
return -1;
/*