return 0 not null string when user has a ctty but no utmp entry
[unix-history] / usr / src / lib / libc / gen / ttyname.3
CommitLineData
03a95d0f 1.\" @(#)ttyname.3 6.1 (Berkeley) %G%
2264871c 2.\"
03a95d0f 3.TH TTYNAME 3 ""
2264871c
KM
4.AT 3
5.SH NAME
6ttyname, isatty, ttyslot \- find name of a terminal
7.SH SYNOPSIS
9959ea4e 8.B char *ttyname(filedes)
2264871c 9.PP
9959ea4e 10.B isatty(filedes)
2264871c
KM
11.PP
12.B ttyslot()
13.SH DESCRIPTION
14.I Ttyname
15returns a pointer to the null-terminated path name
16of the terminal device associated with file descriptor
9959ea4e
KM
17.I filedes
18(this is a system file descriptor and has nothing to do with the
19standard I/O FILE typedef).
2264871c
KM
20.PP
21.I Isatty
22returns 1 if
9959ea4e 23.I filedes
2264871c
KM
24is associated with a terminal device, 0 otherwise.
25.PP
26.I Ttyslot
27returns the number of the entry in the
28.IR ttys (5)
9959ea4e 29file for the control terminal of the current process.
2264871c
KM
30.SH FILES
31/dev/\(**
32.br
33/etc/ttys
34.SH SEE ALSO
35ioctl(2), ttys(5)
36.SH DIAGNOSTICS
37.I Ttyname
38returns a null pointer (0) if
9959ea4e 39.I filedes
2264871c
KM
40does not describe a terminal device in directory `/dev'.
41.PP
42.I Ttyslot
43returns 0 if `/etc/ttys' is inaccessible or if
44it cannot determine the control terminal.
45.SH BUGS
46The return value points to static data
47whose content is overwritten by each call.