TTYNAME

Section: Misc. Reference Manual Pages (3P)
Updated: May 15, 1985
Index Return to Main Contents
 

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.


 

Index

NAME
SYNOPSIS
(ALSO AVAILABLE IN BSD)
DESCRIPTION
RETURN VALUE
FILES
SEE ALSO
BUGS

This document was created by man2html, using the manual pages.
Time: 17:20:57 GMT, March 25, 2025