version 1.12, 2000/02/15 16:52:58 |
version 1.13, 2000/04/14 10:30:32 |
|
|
/* |
/* |
* |
* |
* pty.c |
* pty.c |
* |
* |
* Author: Tatu Ylonen <ylo@cs.hut.fi> |
* Author: Tatu Ylonen <ylo@cs.hut.fi> |
* |
* |
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
* All rights reserved |
* All rights reserved |
* |
* |
* Created: Fri Mar 17 04:37:25 1995 ylo |
* Created: Fri Mar 17 04:37:25 1995 ylo |
* |
* |
* Allocating a pseudo-terminal, and making it the controlling tty. |
* Allocating a pseudo-terminal, and making it the controlling tty. |
* |
* |
*/ |
*/ |
|
|
#include "includes.h" |
#include "includes.h" |
|
|
* returned (the buffer must be able to hold at least 64 characters). |
* returned (the buffer must be able to hold at least 64 characters). |
*/ |
*/ |
|
|
int |
int |
pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) |
pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) |
{ |
{ |
#if defined(HAVE_OPENPTY) || defined(BSD4_4) |
#if defined(HAVE_OPENPTY) || defined(BSD4_4) |
|
|
|
|
/* Releases the tty. Its ownership is returned to root, and permissions to 0666. */ |
/* Releases the tty. Its ownership is returned to root, and permissions to 0666. */ |
|
|
void |
void |
pty_release(const char *ttyname) |
pty_release(const char *ttyname) |
{ |
{ |
if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) |
if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) |
|
|
|
|
/* Makes the tty the processes controlling tty and sets it to sane modes. */ |
/* Makes the tty the processes controlling tty and sets it to sane modes. */ |
|
|
void |
void |
pty_make_controlling_tty(int *ttyfd, const char *ttyname) |
pty_make_controlling_tty(int *ttyfd, const char *ttyname) |
{ |
{ |
int fd; |
int fd; |
|
|
|
|
/* Changes the window size associated with the pty. */ |
/* Changes the window size associated with the pty. */ |
|
|
void |
void |
pty_change_window_size(int ptyfd, int row, int col, |
pty_change_window_size(int ptyfd, int row, int col, |
int xpixel, int ypixel) |
int xpixel, int ypixel) |
{ |
{ |