From 0e9a09d7718f02726b12924f7ddb05a992202aa3 Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Sat, 3 Sep 2011 14:05:24 +0200 Subject: Imported Upstream version 3.9.11 --- pty.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'pty.c') 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; /* -- cgit v1.2.3