NAME
getttyent, getttynam, setttyent, endttyent - interface to
/etc/ttytab
SYNOPSIS
#include <ttyent.h>
struct ttyent *getttyent(void)
struct ttyent *getttynam(const char *name)
int setttyent(void)
void endttyent(void)
DESCRIPTION
The getttyent functions provide an interface to the
/etc/ttytab. (See ttytab(5)).
To read one of these files one calls getttyent() several
times to read the entries in the table until NULL is
returned for end-of-file.
Getttyname() searches the ttytab file for the given terminal
device. It is equivalent to a call to setttyent(), several
calls to getttyent() to locate the entry, and a final
endttyent() to close the file.
Setttyent() opens or rewinds the ttytab database, and
endttyent() closes it. Getttyent() opens the database if not
already open, but does not close it.
The struct ttyent is defined by <ttyent.h> as follows:
struct ttyent {
char *ty_name; /* Name of the terminal device. */
char *ty_type; /* Terminal type name (termcap(3)). */
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 ty_name and
ty_type are filled in. The optional ty_getty and ty_init
may be NULL (field omitted), point to a pointer that is NULL
(null lenght field, i.e. ""), or an array of strings ter-
minated by a NULL (field present). For now no useful dis-
tinction can be made between a omitted field and an empty
field, so treat both cases as an omission.
FILES
/etc/ttytab The terminal device database
SEE ALSO
ttyname(3), ttyslot(3), ttytab(5), init(8).
DIAGNOSTICS
Setttyent() has the same return value and error codes as the
open(2) call it uses to open the ttytab file. The getxxx()
functions return NULL on end of file, entry not found, or
error. You can set errno to zero before the call and check
it after.
NOTES
Getttyent() and getttynam() return a pointer to static
storage that is overwritten in each call.
The MINIX 3 struct ttyent has only the ty_name and ty_type
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 ty_name field.
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)