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

128 lines
3.9 KiB
HTML

<HTML>
<HEAD>
<TITLE>getttyent(3)</TITLE>
</HEAD>
<BODY>
<H1>getttyent(3)</H1>
<HR>
<PRE>
</PRE>
<H2>NAME</H2><PRE>
getttyent, getttynam, setttyent, endttyent - interface to /etc/ttytab
</PRE>
<H2>SYNOPSIS</H2><PRE>
<STRONG>#include</STRONG> <STRONG>&lt;ttyent.h&gt;</STRONG>
<STRONG>struct</STRONG> <STRONG>ttyent</STRONG> <STRONG>*getttyent(void)</STRONG>
<STRONG>struct</STRONG> <STRONG>ttyent</STRONG> <STRONG>*getttynam(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>name</EM><STRONG>)</STRONG>
<STRONG>int</STRONG> <STRONG>setttyent(void)</STRONG>
<STRONG>void</STRONG> <STRONG>endttyent(void)</STRONG>
</PRE>
<H2>DESCRIPTION</H2><PRE>
The <STRONG>getttyent</STRONG> functions provide an interface to the /etc/ttytab. (See
<STRONG><A HREF="../man5/ttytab.5.html">ttytab(5)</A></STRONG>).
To read one of these files one calls <STRONG>getttyent()</STRONG> several times to read
the entries in the table until NULL is returned for end-of-file.
<STRONG>Getttyname()</STRONG> searches the <STRONG>ttytab</STRONG> file for the given terminal device. It
is equivalent to a call to <STRONG>setttyent(),</STRONG> several calls to <STRONG>getttyent()</STRONG> to
locate the entry, and a final <STRONG>endttyent()</STRONG> to close the file.
<STRONG>Setttyent()</STRONG> opens or rewinds the ttytab database, and <STRONG>endttyent()</STRONG> <STRONG>closes</STRONG>
<STRONG>it.</STRONG> <STRONG>Getttyent()</STRONG> opens the database if not already open, but does not
close it.
The struct ttyent is defined by &lt;ttyent.h&gt; as follows:
struct ttyent {
char *ty_name; /* Name of the terminal device. */
char *ty_type; /* Terminal type name (<STRONG><A HREF="../man3/termcap.3.html">termcap(3)</A></STRONG>). */
char **ty_getty; /* Program to run, normally getty. */
char **ty_init; /* Initialization command, normally stty. */
};
A valid entry has at least two strings, so both <STRONG>ty_name</STRONG> and <STRONG>ty_type</STRONG> are
filled in. The optional <STRONG>ty_getty</STRONG> and <STRONG>ty_init</STRONG> may be NULL (field
omitted), point to a pointer that is NULL (null lenght field, i.e. ""),
or an array of strings terminated by a NULL (field present). For now no
useful distinction can be made between a omitted field and an empty
field, so treat both cases as an omission.
</PRE>
<H2>FILES</H2><PRE>
<STRONG>/etc/ttytab</STRONG> The terminal device database
</PRE>
<H2>SEE ALSO</H2><PRE>
<STRONG><A HREF="../man3/ttyname.3.html">ttyname(3)</A></STRONG>, <STRONG><A HREF="../man3/ttyslot.3.html">ttyslot(3)</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>DIAGNOSTICS</H2><PRE>
<STRONG>Setttyent()</STRONG> has the same return value and error codes as the <STRONG><A HREF="../man2/open.2.html">open(2)</A></STRONG> call
it uses to open the ttytab file. The <STRONG>get</STRONG><EM>xxx</EM><STRONG>()</STRONG> functions return NULL on
end of file, entry not found, or error. You can set <STRONG>errno</STRONG> to zero before
the call and check it after.
</PRE>
<H2>NOTES</H2><PRE>
<STRONG>Getttyent()</STRONG> and <STRONG>getttynam()</STRONG> return a pointer to static storage that is
overwritten in each call.
The Minix <STRONG>struct</STRONG> <STRONG>ttyent</STRONG> has only the <STRONG>ty_name</STRONG> and <STRONG>ty_type</STRONG> fields in common
with the BSD implementation. This does not seem to be a problem, because
most third party software that need to know about terminals only look at
the <STRONG>ty_name</STRONG> field.
</PRE>
<H2>AUTHOR</H2><PRE>
Kees J. Bot (kjb@cs.vu.nl)
</PRE>
</BODY>
</HTML>