]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/getttyent.3
alloca.3: Prevent any misunderstanding about when allocated memory is released
[thirdparty/man-pages.git] / man3 / getttyent.3
CommitLineData
fea681da 1.\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2297bf0e 2.\"
38f20bb9 3.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
b18188c5 4.\" Distributed under GPL
38f20bb9 5.\" %%%LICENSE_END
c13182ef 6.\"
4b8c67d9 7.TH GETTTYENT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
fea681da 8.SH NAME
c65433e6 9getttyent, getttynam, setttyent, endttyent \- get ttys file entry
fea681da 10.SH SYNOPSIS
fea681da 11.B "#include <ttyent.h>"
68e4db0a 12.PP
fea681da 13.B "struct ttyent *getttyent(void);"
68e4db0a 14.PP
fea681da 15.BI "struct ttyent *getttynam(const char *" name );
68e4db0a 16.PP
fea681da 17.B "int setttyent(void);"
68e4db0a 18.PP
fea681da
MK
19.B "int endttyent(void);"
20.SH DESCRIPTION
21These functions provide an interface to the file
22.B _PATH_TTYS
23(e.g.,
24.IR /etc/ttys ).
847e0d88 25.PP
c13182ef 26The function
fea681da
MK
27.BR setttyent ()
28opens the file or rewinds it if already open.
847e0d88 29.PP
fea681da 30The function
f87925c6 31.BR endttyent ()
fea681da 32closes the file.
847e0d88 33.PP
c13182ef 34The function
fea681da 35.BR getttynam ()
1285ff3d 36searches for a given terminal name in the file.
c13182ef 37It returns a pointer to a
433dc4d5
MK
38.I ttyent
39structure (description below).
847e0d88 40.PP
fea681da
MK
41The function
42.BR getttyent ()
2f0af33b
MK
43opens the file
44.B _PATH_TTYS
45(if necessary) and returns the first entry.
fea681da 46If the file is already open, the next entry.
5f90f492
MK
47The
48.I ttyent
49structure has the form:
e646a1ba 50.PP
088a639b 51.in +4n
e646a1ba 52.EX
fea681da 53struct ttyent {
5f90f492
MK
54 char *ty_name; /* terminal device name */
55 char *ty_getty; /* command to execute, usually getty */
56 char *ty_type; /* terminal type for termcap */
57 int ty_status; /* status flags */
58 char *ty_window; /* command to start up window manager */
59 char *ty_comment; /* comment field */
fea681da 60};
b8302363 61.EE
5f90f492 62.in
847e0d88 63.PP
fea681da 64.I ty_status
5f90f492 65can be:
207050fa
MK
66.PP
67.in +4n
68.EX
5f90f492
MK
69#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
70#define TTY_SECURE 0x02 /* allow UID 0 to login */
207050fa
MK
71.EE
72.in
8c3a681e 73.SH ATTRIBUTES
849df2a4
PH
74For an explanation of the terms used in this section, see
75.BR attributes (7).
76.TS
77allbox;
78lbw25 lb lb
79l l l.
80Interface Attribute Value
81T{
82.BR getttyent (),
83.BR setttyent (),
84.BR endttyent (),
8c3a681e 85.BR getttynam ()
849df2a4
PH
86T} Thread safety MT-Unsafe race:ttyent
87.TE
47297adb 88.SH CONFORMING TO
5b97d277 89Not in POSIX.1.
2b2581ee 90Present on the BSDs, and perhaps other systems.
fea681da 91.SH NOTES
eb9a0b2f 92Under Linux, the file
fea681da
MK
93.IR /etc/ttys ,
94and the functions described above, are not used.
47297adb 95.SH SEE ALSO
fea681da
MK
96.BR ttyname (3),
97.BR ttyslot (3)