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