Niels M�ller <[EMAIL PROTECTED]> wrote:
> >      The login_tty() function prepares for a login on the tty fd (which
> >      may be a real tty device, or the slave of a pseudo-tty as returned
> >      by openpty()) by creating a new session, making fd the controlling
> >      terminal for the current process, setting fd to be the standard
> >      input, output, and error streams of the current process, and
> >      closing fd.
> 
> Too bad that it sets stderr to the pty. But perhaps it can be hacked not to
> touch stderr.

login_tty is trivial anyway:

int
login_tty(fd)
        int fd;
{
        (void) setsid();
        if (ioctl(fd, TIOCSCTTY, (char *)NULL) == -1)
                return (-1);
        (void) dup2(fd, 0);
        (void) dup2(fd, 1);
        (void) dup2(fd, 2);
        if (fd > 2)
                (void) close(fd);
        return (0);
}

The other functions can be found at
  ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libutil/pty.c

Cheers


Jon
-- 
\/ Jon Ribbens / [EMAIL PROTECTED]

Reply via email to