source: trunk/minix/man/man3/getttyent.3@ 9

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

Minix 3.1.2a

File size: 2.5 KB
Line 
1.TH GETTTYENT 3
2.SH NAME
3getttyent, getttynam, setttyent, endttyent \- interface to /etc/ttytab
4.SH SYNOPSIS
5.ft B
6.nf
7#include <ttyent.h>
8
9struct ttyent *getttyent(void)
10struct ttyent *getttynam(const char *\fIname\fP)
11int setttyent(void)
12void endttyent(void)
13.fi
14.ft P
15.SH DESCRIPTION
16The
17.B getttyent
18functions provide an interface to the /etc/ttytab. (See
19.BR ttytab (5)).
20.PP
21To read one of these files one calls
22.B getttyent()
23several times to read the entries in the table until NULL is returned for
24end-of-file.
25.PP
26.B Getttyname()
27searches the
28.B ttytab
29file for the given terminal device. It is equivalent to a call to
30.BR setttyent(),
31several calls to
32.B getttyent()
33to locate the entry, and a final
34.B endttyent()
35to close the file.
36.PP
37.B Setttyent()
38opens or rewinds the ttytab database, and
39.B endttyent() closes it.
40.B Getttyent()
41opens the database if not already open, but does not close it.
42.PP
43The struct ttyent is defined by <ttyent.h> as follows:
44.sp
45.nf
46.ta +4n +6n +15n
47struct ttyent {
48 char *ty_name; /* Name of the terminal device. */
49 char *ty_type; /* Terminal type name (termcap(3)). */
50 char **ty_getty; /* Program to run, normally getty. */
51 char **ty_init; /* Initialization command, normally stty. */
52};
53.fi
54.PP
55A valid entry has at least two strings, so both
56.B ty_name
57and
58.B ty_type
59are filled in. The optional
60.B ty_getty
61and
62.B ty_init
63may be NULL (field omitted), point to a pointer that is NULL (null lenght
64field, i.e. ""), or an array of strings terminated by a NULL (field
65present). For now no useful distinction can be made between a omitted field
66and an empty field, so treat both cases as an omission.
67.SH FILES
68.TP 15
69.B /etc/ttytab
70The terminal device database
71.SH "SEE ALSO"
72.BR ttyname (3),
73.BR ttyslot (3),
74.BR ttytab (5),
75.BR init (8).
76.SH DIAGNOSTICS
77.B Setttyent()
78has the same return value and error codes as the
79.BR open (2)
80call it uses to open the ttytab file. The
81.BI get xxx ()
82functions return NULL on end of file, entry not found, or error. You can
83set
84.B errno
85to zero before the call and check it after.
86.SH NOTES
87.B Getttyent()
88and
89.B getttynam()
90return a pointer to static storage that is overwritten in each call.
91.PP
92The MINIX 3
93.B struct ttyent
94has only the
95.B ty_name
96and
97.B ty_type
98fields in common with the BSD implementation. This does not seem to be a
99problem, because most third party software that need to know about terminals
100only look at the
101.B ty_name
102field.
103.SH AUTHOR
104Kees J. Bot (kjb@cs.vu.nl)
105
106.\"
107.\" $PchId: getttyent.3,v 1.2 1996/04/11 06:57:26 philip Exp $
Note: See TracBrowser for help on using the repository browser.