source: trunk/minix/man/man3/ttyslot.3@ 12

Last change on this file since 12 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

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