]> git.saurik.com Git - apple/libc.git/blame - gen/getttyent.3
Libc-825.24.tar.gz
[apple/libc.git] / gen / getttyent.3
CommitLineData
5b2abdfb
A
1.\" Copyright (c) 1989, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)getttyent.3 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: src/lib/libc/gen/getttyent.3,v 1.12 2001/10/01 16:08:51 ru Exp $
34.\"
35.Dd November 17, 1996
36.Dt GETTTYENT 3
37.Os
38.Sh NAME
39.Nm getttyent ,
40.Nm getttynam ,
41.Nm setttyent ,
42.Nm endttyent
43.Nd get ttys file entry
5b2abdfb
A
44.Sh LIBRARY
45.Lb libc
46.Sh SYNOPSIS
47.In ttyent.h
48.Ft struct ttyent *
49.Fn getttyent void
50.Ft struct ttyent *
51.Fn getttynam "const char *name"
52.Ft int
53.Fn setttyent void
54.Ft int
55.Fn endttyent void
5b2abdfb
A
56.Sh DESCRIPTION
57The
58.Fn getttyent ,
59and
60.Fn getttynam
61functions
62each return a pointer to an object, with the following structure,
63containing the broken-out fields of a line from the tty description
64file.
65.Bd -literal
66struct ttyent {
67 char *ty_name; /* terminal device name */
68 char *ty_getty; /* command to execute, usually getty */
69 char *ty_type; /* terminal type for termcap */
70#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
71#define TTY_SECURE 0x02 /* allow uid of 0 to login */
72#define TTY_DIALUP 0x04 /* is a dialup tty */
73#define TTY_NETWORK 0x08 /* is a network tty */
74 int ty_status; /* status flags */
75 char *ty_window; /* command to start up window manager */
76 char *ty_comment; /* comment field */
77 char *ty_group; /* tty group name */
78};
79.Ed
80.Pp
81The fields are as follows:
82.Bl -tag -width ty_comment
83.It Fa ty_name
84The name of the character-special file.
85.It Fa ty_getty
86The name of the command invoked by
87.Xr init 8
88to initialize tty line characteristics.
89.It Fa ty_type
90The name of the default terminal type connected to this tty line.
91.It Fa ty_status
92A mask of bit fields which indicate various actions allowed on this
93tty line.
94The possible flags are as follows:
95.Bl -tag -width TTY_NETWORK
96.It Dv TTY_ON
97Enables logins (i.e.,
98.Xr init 8
99will start the command referenced by
100.Fa ty_getty
101on this entry).
102.It Dv TTY_SECURE
103Allow users with a uid of 0 to login on this terminal.
104.It Dv TTY_DIALUP
105Identifies a tty as a dialin line.
5b2abdfb
A
106.It Dv TTY_NETWORK
107Identifies a tty used for network connections.
5b2abdfb
A
108.El
109.It Fa ty_window
110The command to execute for a window system associated with the line.
111.It Fa ty_group
112A group name to which the tty belongs.
113If no group is specified in the ttys description file,
114then the tty is placed in an anonymous group called "none".
115.It Fa ty_comment
116Any trailing comment field, with any leading hash marks (``#'') or
117whitespace removed.
118.El
119.Pp
120If any of the fields pointing to character strings are unspecified,
121they are returned as null pointers.
122The field
123.Fa ty_status
124will be zero if no flag values are specified.
125.Pp
126See
127.Xr ttys 5
128for a more complete discussion of the meaning and usage of the
129fields.
130.Pp
131The
132.Fn getttyent
133function
134reads the next line from the ttys file, opening the file if necessary.
135The
136.Fn setttyent
137function
138rewinds the file if open, or opens the file if it is unopened.
139The
140.Fn endttyent
141function
142closes any open files.
143.Pp
144The
145.Fn getttynam
146function
147searches from the beginning of the file until a matching
148.Fa name
149is found
150(or until
151.Dv EOF
152is encountered).
153.Sh RETURN VALUES
154The routines
155.Fn getttyent
156and
157.Fn getttynam
158return a null pointer on
159.Dv EOF
160or error.
161The
162.Fn setttyent
163function
164and
165.Fn endttyent
166return 0 on failure and 1 on success.
5b2abdfb
A
167.Sh FILES
168.Bl -tag -width /etc/ttys -compact
169.It Pa /etc/ttys
170.El
171.Sh SEE ALSO
172.Xr login 1 ,
173.Xr ttyslot 3 ,
174.Xr gettytab 5 ,
175.Xr termcap 5 ,
176.Xr ttys 5 ,
177.Xr getty 8 ,
178.Xr init 8
179.Sh HISTORY
180The
181.Fn getttyent ,
182.Fn getttynam ,
183.Fn setttyent ,
184and
185.Fn endttyent
186functions appeared in
187.Bx 4.3 .
188.Sh BUGS
189These functions use static data storage;
190if the data is needed for future use, it should be
191copied before any subsequent calls overwrite it.