Blame man3/getttyent.3

Packit 7cfc04
.\"  Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
Packit 7cfc04
.\" Distributed under GPL
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH GETTTYENT 3 2017-09-15  "GNU" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
getttyent, getttynam, setttyent, endttyent \- get ttys file entry
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.B "#include <ttyent.h>"
Packit 7cfc04
.PP
Packit 7cfc04
.B "struct ttyent *getttyent(void);"
Packit 7cfc04
.PP
Packit 7cfc04
.BI "struct ttyent *getttynam(const char *" name );
Packit 7cfc04
.PP
Packit 7cfc04
.B "int setttyent(void);"
Packit 7cfc04
.PP
Packit 7cfc04
.B "int endttyent(void);"
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
These functions provide an interface to the file
Packit 7cfc04
.B _PATH_TTYS
Packit 7cfc04
(e.g.,
Packit 7cfc04
.IR /etc/ttys ).
Packit 7cfc04
.PP
Packit 7cfc04
The function
Packit 7cfc04
.BR setttyent ()
Packit 7cfc04
opens the file or rewinds it if already open.
Packit 7cfc04
.PP
Packit 7cfc04
The function
Packit 7cfc04
.BR endttyent ()
Packit 7cfc04
closes the file.
Packit 7cfc04
.PP
Packit 7cfc04
The function
Packit 7cfc04
.BR getttynam ()
Packit 7cfc04
searches for a given terminal name in the file.
Packit 7cfc04
It returns a pointer to a
Packit 7cfc04
.I ttyent
Packit 7cfc04
structure (description below).
Packit 7cfc04
.PP
Packit 7cfc04
The function
Packit 7cfc04
.BR getttyent ()
Packit 7cfc04
opens the file
Packit 7cfc04
.B _PATH_TTYS
Packit 7cfc04
(if necessary) and returns the first entry.
Packit 7cfc04
If the file is already open, the next entry.
Packit 7cfc04
The
Packit 7cfc04
.I ttyent
Packit 7cfc04
structure has the form:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
struct ttyent {
Packit 7cfc04
    char *ty_name;     /* terminal device name */
Packit 7cfc04
    char *ty_getty;    /* command to execute, usually getty */
Packit 7cfc04
    char *ty_type;     /* terminal type for termcap */
Packit 7cfc04
    int   ty_status;   /* status flags */
Packit 7cfc04
    char *ty_window;   /* command to start up window manager */
Packit 7cfc04
    char *ty_comment;  /* comment field */
Packit 7cfc04
};
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
.I ty_status
Packit 7cfc04
can be:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
#define TTY_ON     0x01  /* enable logins (start ty_getty program) */
Packit 7cfc04
#define TTY_SECURE 0x02  /* allow UID 0 to login */
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.SH ATTRIBUTES
Packit 7cfc04
For an explanation of the terms used in this section, see
Packit 7cfc04
.BR attributes (7).
Packit 7cfc04
.TS
Packit 7cfc04
allbox;
Packit 7cfc04
lbw25 lb lb
Packit 7cfc04
l l l.
Packit 7cfc04
Interface	Attribute	Value
Packit 7cfc04
T{
Packit 7cfc04
.BR getttyent (),
Packit 7cfc04
.BR setttyent (),
Packit 7cfc04
.BR endttyent (),
Packit 7cfc04
.BR getttynam ()
Packit 7cfc04
T}	Thread safety	MT-Unsafe race:ttyent
Packit 7cfc04
.TE
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
Not in POSIX.1.
Packit 7cfc04
Present on the BSDs, and perhaps other systems.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
Under Linux, the file
Packit 7cfc04
.IR /etc/ttys ,
Packit 7cfc04
and the functions described above, are not used.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR ttyname (3),
Packit 7cfc04
.BR ttyslot (3)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.