Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ioctl(2)

ttys(5)

TTYNAME(3P)  —  UNIX Programmer’s Manual

NAME

ttyname, isatty − find name of a terminal

SYNOPSIS

#include <unistd.h>

char ∗ttyname(int fd)

int isatty(int fd)

(ALSO AVAILABLE IN BSD)

int ttyslot(void);

DESCRIPTION

Ttyname returns a pointer to the null-terminated path name of the terminal device associated with file descriptor fd.

Isatty returns 1 if fd is associated with a terminal device, 0 otherwise. 

Ttyslot returns the number of the entry in the ttys(5) file for the control terminal of the current process. Ttyslot is not a POSIX function. 

RETURN VALUE

The ttyname function returns a NULL pointer if fd is not a valid file descriptor associated with a terminal or if the pathname cannot be determined. 

Ttyslot returns 0 if ‘/etc/ttys’ is inaccessible or if it cannot determine the control terminal. 

FILES

/dev/∗
/etc/ttys

SEE ALSO

ioctl(2), ttys(5)

BUGS

The return value points to static data whose content is overwritten by each call. 

7th Edition  —  May 15, 1985

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026