new copyright notice
[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.\"
06c5d283
KB
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15.\"
16.\" @(#)getttyent.3 6.5 (Berkeley) %G%
53e9b2ee
KM
17.\"
18.TH GETTTYENT 3 ""
19.UC 6
20.SH NAME
21getttyent, getttynam, setttyent, endttyent \- get ttys file entry
22.SH SYNOPSIS
23.nf
24.B #include <ttyent.h>
25.PP
26.B struct ttyent *getttyent()
27.PP
28.B struct ttyent *getttynam(name)
29.B char *name;
30.PP
1b848515 31.B setttyent()
53e9b2ee 32.PP
1b848515 33.B endttyent()
53e9b2ee
KM
34.fi
35.SH DESCRIPTION
36.I Getttyent,
37and
38.I getttynam
06c5d283
KB
39each return a pointer to an object, with the following structure,
40containing the broken-out fields of a line from the tty description
41file.
42.sp
53e9b2ee 43.nf
06c5d283
KB
44struct ttyent {
45 char *ty_name; /* terminal device name */
46 char *ty_getty; /* command to execute */
47 char *ty_type; /* terminal type */
48#define TTY_ON 0x01 /* enable logins */
49#define TTY_SECURE 0x02 /* allow uid of 0 to login */
50 int ty_status; /* flag values */
51 char *ty_window; /* command for window manager */
52 char *ty_comment; /* comment field */
53};
53e9b2ee 54.fi
53e9b2ee 55.PP
06c5d283
KB
56The fields are as follows:
57.TP
58ty_name
59The name of the character-special file.
60.TP
61ty_getty
62The name of the command invoked by
63.IR init (8)
53e9b2ee 64to initialize tty line characteristics.
06c5d283
KB
65.TP
66ty_type
67The name of the default terminal type connected to this tty line.
68.TP
69ty_status
70A mask of bit fields which indicate various actions allowed on this
71tty line.
72The possible flags are as follows:
73.IP
74TTY_ON
75.IP
49b0b294 76Enables logins (i.e.,
53e9b2ee 77.IR init (8)
06c5d283 78will start the command referenced by
bcba0a8e 79.I ty_getty
06c5d283
KB
80on this entry).
81.IP
82TTY_SECURE
83.IP
84Allow users with a uid of 0 to login on this terminal.
85.TP
86ty_window
87The command to execute for a window system associated with the line.
88.TP
89ty_comment
90Any trailing comment field, with any leading hash marks (``#'') or
91whitespace removed.
92.PP
93If any of the fields pointing to character strings are unspecified,
94they are returned as null pointers.
95The field
96.I ty_status
97will be zero if no flag values are specified.
98.PP
99See
100.IR ttys (5)
101for a more complete discussion of the meaning and usage of the
102fields.
53e9b2ee
KM
103.PP
104.I Getttyent
06c5d283
KB
105reads the next line from the ttys file, opening the file if necessary.
106.I Setttyent
107rewinds the file if open, or opens the file if it is unopened.
108.I Endttyent
109closes any open files.
53e9b2ee
KM
110.PP
111.I Getttynam
112searches from the beginning of the file until a matching
113.I name
114is found
115(or until EOF is encountered).
116.SH FILES
117/etc/ttys
118.SH "SEE ALSO"
06c5d283 119login(1), ttyslot(3), gettytab(5), termcap(5), ttys(5), getty(8), init(8)
53e9b2ee 120.SH DIAGNOSTICS
06c5d283
KB
121The routines
122.I getttyent
123and
124.I getttynam
125return a null pointer on EOF or error.
126.I Setttyent
127and
128.I endttyent
129return 0 on failure and 1 on success.
53e9b2ee 130.SH BUGS
06c5d283
KB
131All information is contained in a static area so it must be copied if
132it is to be saved.