new copyright; att/bsd/shared
[unix-history] / usr / src / lib / libc / gen / getttyent.3
CommitLineData
06c5d283
KB
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
53e9b2ee 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
06c5d283 5.\"
91cff1e1 6.\" @(#)getttyent.3 6.6 (Berkeley) %G%
53e9b2ee
KM
7.\"
8.TH GETTTYENT 3 ""
9.UC 6
10.SH NAME
11getttyent, getttynam, setttyent, endttyent \- get ttys file entry
12.SH SYNOPSIS
13.nf
14.B #include <ttyent.h>
15.PP
16.B struct ttyent *getttyent()
17.PP
18.B struct ttyent *getttynam(name)
19.B char *name;
20.PP
1b848515 21.B setttyent()
53e9b2ee 22.PP
1b848515 23.B endttyent()
53e9b2ee
KM
24.fi
25.SH DESCRIPTION
26.I Getttyent,
27and
28.I getttynam
06c5d283
KB
29each return a pointer to an object, with the following structure,
30containing the broken-out fields of a line from the tty description
31file.
32.sp
53e9b2ee 33.nf
06c5d283
KB
34struct ttyent {
35 char *ty_name; /* terminal device name */
36 char *ty_getty; /* command to execute */
37 char *ty_type; /* terminal type */
38#define TTY_ON 0x01 /* enable logins */
39#define TTY_SECURE 0x02 /* allow uid of 0 to login */
40 int ty_status; /* flag values */
41 char *ty_window; /* command for window manager */
42 char *ty_comment; /* comment field */
43};
53e9b2ee 44.fi
53e9b2ee 45.PP
06c5d283
KB
46The fields are as follows:
47.TP
48ty_name
49The name of the character-special file.
50.TP
51ty_getty
52The name of the command invoked by
53.IR init (8)
53e9b2ee 54to initialize tty line characteristics.
06c5d283
KB
55.TP
56ty_type
57The name of the default terminal type connected to this tty line.
58.TP
59ty_status
60A mask of bit fields which indicate various actions allowed on this
61tty line.
62The possible flags are as follows:
63.IP
64TTY_ON
65.IP
49b0b294 66Enables logins (i.e.,
53e9b2ee 67.IR init (8)
06c5d283 68will start the command referenced by
bcba0a8e 69.I ty_getty
06c5d283
KB
70on this entry).
71.IP
72TTY_SECURE
73.IP
74Allow users with a uid of 0 to login on this terminal.
75.TP
76ty_window
77The command to execute for a window system associated with the line.
78.TP
79ty_comment
80Any trailing comment field, with any leading hash marks (``#'') or
81whitespace removed.
82.PP
83If any of the fields pointing to character strings are unspecified,
84they are returned as null pointers.
85The field
86.I ty_status
87will be zero if no flag values are specified.
88.PP
89See
90.IR ttys (5)
91for a more complete discussion of the meaning and usage of the
92fields.
53e9b2ee
KM
93.PP
94.I Getttyent
06c5d283
KB
95reads the next line from the ttys file, opening the file if necessary.
96.I Setttyent
97rewinds the file if open, or opens the file if it is unopened.
98.I Endttyent
99closes any open files.
53e9b2ee
KM
100.PP
101.I Getttynam
102searches from the beginning of the file until a matching
103.I name
104is found
105(or until EOF is encountered).
106.SH FILES
107/etc/ttys
108.SH "SEE ALSO"
06c5d283 109login(1), ttyslot(3), gettytab(5), termcap(5), ttys(5), getty(8), init(8)
53e9b2ee 110.SH DIAGNOSTICS
06c5d283
KB
111The routines
112.I getttyent
113and
114.I getttynam
115return a null pointer on EOF or error.
116.I Setttyent
117and
118.I endttyent
119return 0 on failure and 1 on success.
53e9b2ee 120.SH BUGS
06c5d283
KB
121All information is contained in a static area so it must be copied if
122it is to be saved.