Files
oldlinux-files/Minix/2.0.0/wwwman/man3/ttyslot.3.html
2024-02-19 00:21:39 -05:00

74 lines
2.1 KiB
HTML

<HTML>
<HEAD>
<TITLE>ttyslot(3)</TITLE>
</HEAD>
<BODY>
<H1>ttyslot(3)</H1>
<HR>
<PRE>
</PRE>
<H2>NAME</H2><PRE>
ttyslot, fttyslot - utmp slot number
</PRE>
<H2>SYNOPSIS</H2><PRE>
<STRONG>#define</STRONG> <STRONG>_MINIX_SOURCE</STRONG> <STRONG>1</STRONG>
<STRONG>#include</STRONG> <STRONG>&lt;unistd.h&gt;</STRONG>
<STRONG>int</STRONG> <STRONG>ttyslot(void)</STRONG>
<STRONG>int</STRONG> <STRONG>fttyslot(int</STRONG> <EM>fd</EM><STRONG>)</STRONG>
</PRE>
<H2>DESCRIPTION</H2><PRE>
<STRONG>Ttyslot()</STRONG> returns the index of the login terminal in the <STRONG>utmp</STRONG> file. It
tries <STRONG>fttyslot()</STRONG> on file descriptors <STRONG>0,</STRONG> <STRONG>1,</STRONG> and <STRONG>2</STRONG> to find the index.
<STRONG>Fttyslot()</STRONG> returns the utmp index of the terminal associated with file
descriptor <EM>fd</EM>. First it tries to map <EM>fd</EM> to a terminal name with
<STRONG><A HREF="../man3/ttyname.3.html">ttyname(3)</A></STRONG>, then it searches the <STRONG><A HREF="../man5/ttytab.5.html">ttytab(5)</A></STRONG> database with the <STRONG><A HREF="../man3/getttyent.3.html">getttyent(3)</A></STRONG>
function for this terminal. This means that the utmp slot number is the
same as the ttytab entry number counting from 1. The value 0 is returned
if no slot number can be found for a file descriptor.
</PRE>
<H2>SEE ALSO</H2><PRE>
<STRONG><A HREF="../man3/ttyname.3.html">ttyname(3)</A></STRONG>, <STRONG><A HREF="../man3/getttyent.3.html">getttyent(3)</A></STRONG>, <STRONG><A HREF="../man5/utmp.5.html">utmp(5)</A></STRONG>, <STRONG><A HREF="../man5/ttytab.5.html">ttytab(5)</A></STRONG>, <STRONG><A HREF="../man8/init.8.html">init(8)</A></STRONG>.
</PRE>
<H2>NOTES</H2><PRE>
Since 0 is used as an error return this means that the first entry in the
utmp file is not used.
<STRONG>Ttyslot()</STRONG> is often found in a UNIX implementation, <STRONG>fttyslot()</STRONG> is Minix
specific.
</PRE>
<H2>AUTHOR</H2><PRE>
Kees J. Bot (kjb@cs.vu.nl)
</PRE>
</BODY>
</HTML>