Commit | Line | Data |
---|---|---|
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 | |
21 | getttyent, 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, | |
37 | and | |
38 | .I getttynam | |
06c5d283 KB |
39 | each return a pointer to an object, with the following structure, |
40 | containing the broken-out fields of a line from the tty description | |
41 | file. | |
42 | .sp | |
53e9b2ee | 43 | .nf |
06c5d283 KB |
44 | struct 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 |
56 | The fields are as follows: |
57 | .TP | |
58 | ty_name | |
59 | The name of the character-special file. | |
60 | .TP | |
61 | ty_getty | |
62 | The name of the command invoked by | |
63 | .IR init (8) | |
53e9b2ee | 64 | to initialize tty line characteristics. |
06c5d283 KB |
65 | .TP |
66 | ty_type | |
67 | The name of the default terminal type connected to this tty line. | |
68 | .TP | |
69 | ty_status | |
70 | A mask of bit fields which indicate various actions allowed on this | |
71 | tty line. | |
72 | The possible flags are as follows: | |
73 | .IP | |
74 | TTY_ON | |
75 | .IP | |
49b0b294 | 76 | Enables logins (i.e., |
53e9b2ee | 77 | .IR init (8) |
06c5d283 | 78 | will start the command referenced by |
bcba0a8e | 79 | .I ty_getty |
06c5d283 KB |
80 | on this entry). |
81 | .IP | |
82 | TTY_SECURE | |
83 | .IP | |
84 | Allow users with a uid of 0 to login on this terminal. | |
85 | .TP | |
86 | ty_window | |
87 | The command to execute for a window system associated with the line. | |
88 | .TP | |
89 | ty_comment | |
90 | Any trailing comment field, with any leading hash marks (``#'') or | |
91 | whitespace removed. | |
92 | .PP | |
93 | If any of the fields pointing to character strings are unspecified, | |
94 | they are returned as null pointers. | |
95 | The field | |
96 | .I ty_status | |
97 | will be zero if no flag values are specified. | |
98 | .PP | |
99 | See | |
100 | .IR ttys (5) | |
101 | for a more complete discussion of the meaning and usage of the | |
102 | fields. | |
53e9b2ee KM |
103 | .PP |
104 | .I Getttyent | |
06c5d283 KB |
105 | reads the next line from the ttys file, opening the file if necessary. |
106 | .I Setttyent | |
107 | rewinds the file if open, or opens the file if it is unopened. | |
108 | .I Endttyent | |
109 | closes any open files. | |
53e9b2ee KM |
110 | .PP |
111 | .I Getttynam | |
112 | searches from the beginning of the file until a matching | |
113 | .I name | |
114 | is found | |
115 | (or until EOF is encountered). | |
116 | .SH FILES | |
117 | /etc/ttys | |
118 | .SH "SEE ALSO" | |
06c5d283 | 119 | login(1), ttyslot(3), gettytab(5), termcap(5), ttys(5), getty(8), init(8) |
53e9b2ee | 120 | .SH DIAGNOSTICS |
06c5d283 KB |
121 | The routines |
122 | .I getttyent | |
123 | and | |
124 | .I getttynam | |
125 | return a null pointer on EOF or error. | |
126 | .I Setttyent | |
127 | and | |
128 | .I endttyent | |
129 | return 0 on failure and 1 on success. | |
53e9b2ee | 130 | .SH BUGS |
06c5d283 KB |
131 | All information is contained in a static area so it must be copied if |
132 | it is to be saved. |