]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getttyent.3
ee5034e4e5ef696aa37b2aac7d01a7124f7a593d
[thirdparty/man-pages.git] / man3 / getttyent.3
1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\"
3 .\" SPDX-License-Identifier: GPL-1.0-or-later
4 .\"
5 .TH GETTTYENT 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
6 .SH NAME
7 getttyent, getttynam, setttyent, endttyent \- get ttys file entry
8 .SH LIBRARY
9 Standard C library
10 .RI ( libc ", " \-lc )
11 .SH SYNOPSIS
12 .nf
13 .B "#include <ttyent.h>"
14 .PP
15 .B "struct ttyent *getttyent(void);"
16 .BI "struct ttyent *getttynam(const char *" name );
17 .PP
18 .B "int setttyent(void);"
19 .B "int endttyent(void);"
20 .fi
21 .SH DESCRIPTION
22 These functions provide an interface to the file
23 .B _PATH_TTYS
24 (e.g.,
25 .IR /etc/ttys ).
26 .PP
27 The function
28 .BR setttyent ()
29 opens the file or rewinds it if already open.
30 .PP
31 The function
32 .BR endttyent ()
33 closes the file.
34 .PP
35 The function
36 .BR getttynam ()
37 searches for a given terminal name in the file.
38 It returns a pointer to a
39 .I ttyent
40 structure (description below).
41 .PP
42 The function
43 .BR getttyent ()
44 opens the file
45 .B _PATH_TTYS
46 (if necessary) and returns the first entry.
47 If the file is already open, the next entry.
48 The
49 .I ttyent
50 structure has the form:
51 .PP
52 .in +4n
53 .EX
54 struct ttyent {
55 char *ty_name; /* terminal device name */
56 char *ty_getty; /* command to execute, usually getty */
57 char *ty_type; /* terminal type for termcap */
58 int ty_status; /* status flags */
59 char *ty_window; /* command to start up window manager */
60 char *ty_comment; /* comment field */
61 };
62 .EE
63 .in
64 .PP
65 .I ty_status
66 can be:
67 .PP
68 .in +4n
69 .EX
70 #define TTY_ON 0x01 /* enable logins (start ty_getty program) */
71 #define TTY_SECURE 0x02 /* allow UID 0 to login */
72 .EE
73 .in
74 .SH ATTRIBUTES
75 For an explanation of the terms used in this section, see
76 .BR attributes (7).
77 .ad l
78 .nh
79 .TS
80 allbox;
81 lbx lb lb
82 l l l.
83 Interface Attribute Value
84 T{
85 .BR getttyent (),
86 .BR setttyent (),
87 .BR endttyent (),
88 .BR getttynam ()
89 T} Thread safety MT-Unsafe race:ttyent
90 .TE
91 .hy
92 .ad
93 .sp 1
94 .SH STANDARDS
95 Not in POSIX.1.
96 Present on the BSDs, and perhaps other systems.
97 .SH NOTES
98 Under Linux, the file
99 .IR /etc/ttys ,
100 and the functions described above, are not used.
101 .SH SEE ALSO
102 .BR ttyname (3),
103 .BR ttyslot (3)