date and time created 91/03/06 18:09:53 by bostic
[unix-history] / usr / src / lib / libutil / login_tty.c
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* %sccs.include.redist.c%
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)login_tty.c 1.2 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/ioctl.h>
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);
}