Rev | Line | |
---|
[9] | 1 | .TH TTYSLOT 3
|
---|
| 2 | .SH NAME
|
---|
| 3 | ttyslot, fttyslot \- utmp slot number
|
---|
| 4 | .SH SYNOPSIS
|
---|
| 5 | .nf
|
---|
| 6 | .ft B
|
---|
| 7 | #define _MINIX_SOURCE 1
|
---|
| 8 | #include <unistd.h>
|
---|
| 9 |
|
---|
| 10 | int ttyslot(void)
|
---|
| 11 | int fttyslot(int \fIfd\fP)
|
---|
| 12 | .fi
|
---|
| 13 | .ft P
|
---|
| 14 | .SH DESCRIPTION
|
---|
| 15 | .B Ttyslot()
|
---|
| 16 | returns the index of the login terminal in the
|
---|
| 17 | .B utmp
|
---|
| 18 | file. It tries
|
---|
| 19 | .B fttyslot()
|
---|
| 20 | on file descriptors
|
---|
| 21 | .BR 0,
|
---|
| 22 | .BR 1,
|
---|
| 23 | and
|
---|
| 24 | .BR 2
|
---|
| 25 | to find the index.
|
---|
| 26 | .PP
|
---|
| 27 | .B Fttyslot()
|
---|
| 28 | returns the utmp index of the terminal associated with file descriptor
|
---|
| 29 | .IR fd .
|
---|
| 30 | First it tries to map
|
---|
| 31 | .I fd
|
---|
| 32 | to a terminal name with
|
---|
| 33 | .BR ttyname (3),
|
---|
| 34 | then it searches the
|
---|
| 35 | .BR ttytab (5)
|
---|
| 36 | database with the
|
---|
| 37 | .BR getttyent (3)
|
---|
| 38 | function for this terminal. This means that the utmp slot number is the
|
---|
| 39 | same as the ttytab entry number counting from 1. The value 0 is returned if
|
---|
| 40 | no slot number can be found for a file descriptor.
|
---|
| 41 | .SH "SEE ALSO"
|
---|
| 42 | .BR ttyname (3),
|
---|
| 43 | .BR getttyent (3),
|
---|
| 44 | .BR utmp (5),
|
---|
| 45 | .BR ttytab (5),
|
---|
| 46 | .BR init (8).
|
---|
| 47 | .SH NOTES
|
---|
| 48 | Since 0 is used as an error return this means that the first entry in the
|
---|
| 49 | utmp file is not used.
|
---|
| 50 | .PP
|
---|
| 51 | .B Ttyslot()
|
---|
| 52 | is often found in a UNIX implementation,
|
---|
| 53 | .B fttyslot()
|
---|
| 54 | is MINIX 3 specific.
|
---|
| 55 | .SH AUTHOR
|
---|
| 56 | Kees J. Bot (kjb@cs.vu.nl)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.