1GETTTYENT(3) Library Functions Manual GETTTYENT(3)
2
3
4
6 getttyent, getttynam, setttyent, endttyent - get ttys file entry
7
9 #include <ttyent.h>
10
11 struct ttyent *getttyent()
12
13 struct ttyent *getttynam(name)
14 char *name;
15
16 setttyent()
17
18 endttyent()
19
21 Getttyent, and getttynam each return a pointer to an object with the
22 following structure containing the broken-out fields of a line from the
23 tty description file.
24
25 /*
26 * Copyright (c) 1989, 1993
27 * The Regents of the University of California. All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 * 1. Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 * 4. Neither the name of the University nor the names of its contributors
38 * may be used to endorse or promote products derived from this software
39 * without specific prior written permission.
40 *
41 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * @(#)ttyent.h 8.1 (Berkeley) 6/2/93
54 */
55
56 #ifndef _TTYENT_H
57 #define _TTYENT_H 1
58
59 #include <features.h>
60
61 #define _PATH_TTYS "/etc/ttys"
62
63 #define _TTYS_OFF "off"
64 #define _TTYS_ON "on"
65 #define _TTYS_SECURE "secure"
66 #define _TTYS_WINDOW "window"
67
68 struct ttyent {
69 char *ty_name; /* terminal device name */
70 char *ty_getty; /* command to execute, usually getty */
71 char *ty_type; /* terminal type for termcap */
72 #define TTY_ON 0x01 /* enable logins (start ty_getty program) */
73 #define TTY_SECURE 0x02 /* allow uid of 0 to login */
74 int ty_status; /* status flags */
75 char *ty_window; /* command to start up window manager */
76 char *ty_comment; /* comment field */
77 };
78
79
80 __BEGIN_DECLS
81
82 extern struct ttyent *getttyent (void) __THROW;
83 extern struct ttyent *getttynam (const char *__tty) __THROW;
84 extern int setttyent (void) __THROW;
85 extern int endttyent (void) __THROW;
86
87 __END_DECLS
88
89 #endif /* ttyent.h */
90
91 ty_name is the name of the character-special file in the directory
92 ``/dev". For various reasons, it must reside in the
93 directory ``/dev".
94
95 ty_getty is the command (usually getty(8)) which is invoked by init
96 to initialize tty line characteristics. In fact, any
97 arbitrary command can be used; a typical use is to initi‐
98 ate a terminal emulator in a window system.
99
100 ty_type is the name of the default terminal type connected to this
101 tty line. This is typically a name from the termcap(5)
102 data base. The environment variable `TERM' is initialized
103 with this name by getty(8) or login(1).
104
105 ty_status is a mask of bit fields which indicate various actions to
106 be allowed on this tty line. The following is a descrip‐
107 tion of each flag.
108
109 TTY_ON Enables logins (i.e., init(8) will start the
110 specified ``getty" command on this entry).
111
112 TTY_SECURE Allows root to login on this terminal. Note
113 that `TTY_ON' must be included for this to be
114 useful.
115
116 ty_window is the command to execute for a window system associated
117 with the line. The window system will be started before
118 the command specified in the ty_getty entry is executed.
119 If none is specified, this will be null.
120
121 ty_comment is the trailing comment field, if any; a leading delimiter
122 and white space will be removed.
123
124 Getttyent reads the next line from the ttys file, opening the file if
125 necessary; setttyent rewinds the file; endttyent closes it.
126
127 Getttynam searches from the beginning of the file until a matching name
128 is found (or until EOF is encountered).
129
131 /etc/ttys
132
134 login(1), ttyslot(3), ttys(5), gettytab(5), termcap(5), getty(8),
135 init(8)
136
138 Null pointer (0) returned on EOF or error.
139
141 All information is contained in a static area so it must be copied if
142 it is to be saved.
143
144
145
1464.3 Berkeley Distribution May 20, 1986 GETTTYENT(3)