Commit | Line | Data |
---|---|---|
06c5d283 KB |
1 | .\" Copyright (c) 1989 The Regents of the University of California. |
2 | .\" All rights reserved. | |
53e9b2ee | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
06c5d283 | 5 | .\" |
91cff1e1 | 6 | .\" @(#)getttyent.3 6.6 (Berkeley) %G% |
53e9b2ee KM |
7 | .\" |
8 | .TH GETTTYENT 3 "" | |
9 | .UC 6 | |
10 | .SH NAME | |
11 | getttyent, getttynam, setttyent, endttyent \- get ttys file entry | |
12 | .SH SYNOPSIS | |
13 | .nf | |
14 | .B #include <ttyent.h> | |
15 | .PP | |
16 | .B struct ttyent *getttyent() | |
17 | .PP | |
18 | .B struct ttyent *getttynam(name) | |
19 | .B char *name; | |
20 | .PP | |
1b848515 | 21 | .B setttyent() |
53e9b2ee | 22 | .PP |
1b848515 | 23 | .B endttyent() |
53e9b2ee KM |
24 | .fi |
25 | .SH DESCRIPTION | |
26 | .I Getttyent, | |
27 | and | |
28 | .I getttynam | |
06c5d283 KB |
29 | each return a pointer to an object, with the following structure, |
30 | containing the broken-out fields of a line from the tty description | |
31 | file. | |
32 | .sp | |
53e9b2ee | 33 | .nf |
06c5d283 KB |
34 | struct ttyent { |
35 | char *ty_name; /* terminal device name */ | |
36 | char *ty_getty; /* command to execute */ | |
37 | char *ty_type; /* terminal type */ | |
38 | #define TTY_ON 0x01 /* enable logins */ | |
39 | #define TTY_SECURE 0x02 /* allow uid of 0 to login */ | |
40 | int ty_status; /* flag values */ | |
41 | char *ty_window; /* command for window manager */ | |
42 | char *ty_comment; /* comment field */ | |
43 | }; | |
53e9b2ee | 44 | .fi |
53e9b2ee | 45 | .PP |
06c5d283 KB |
46 | The fields are as follows: |
47 | .TP | |
48 | ty_name | |
49 | The name of the character-special file. | |
50 | .TP | |
51 | ty_getty | |
52 | The name of the command invoked by | |
53 | .IR init (8) | |
53e9b2ee | 54 | to initialize tty line characteristics. |
06c5d283 KB |
55 | .TP |
56 | ty_type | |
57 | The name of the default terminal type connected to this tty line. | |
58 | .TP | |
59 | ty_status | |
60 | A mask of bit fields which indicate various actions allowed on this | |
61 | tty line. | |
62 | The possible flags are as follows: | |
63 | .IP | |
64 | TTY_ON | |
65 | .IP | |
49b0b294 | 66 | Enables logins (i.e., |
53e9b2ee | 67 | .IR init (8) |
06c5d283 | 68 | will start the command referenced by |
bcba0a8e | 69 | .I ty_getty |
06c5d283 KB |
70 | on this entry). |
71 | .IP | |
72 | TTY_SECURE | |
73 | .IP | |
74 | Allow users with a uid of 0 to login on this terminal. | |
75 | .TP | |
76 | ty_window | |
77 | The command to execute for a window system associated with the line. | |
78 | .TP | |
79 | ty_comment | |
80 | Any trailing comment field, with any leading hash marks (``#'') or | |
81 | whitespace removed. | |
82 | .PP | |
83 | If any of the fields pointing to character strings are unspecified, | |
84 | they are returned as null pointers. | |
85 | The field | |
86 | .I ty_status | |
87 | will be zero if no flag values are specified. | |
88 | .PP | |
89 | See | |
90 | .IR ttys (5) | |
91 | for a more complete discussion of the meaning and usage of the | |
92 | fields. | |
53e9b2ee KM |
93 | .PP |
94 | .I Getttyent | |
06c5d283 KB |
95 | reads the next line from the ttys file, opening the file if necessary. |
96 | .I Setttyent | |
97 | rewinds the file if open, or opens the file if it is unopened. | |
98 | .I Endttyent | |
99 | closes any open files. | |
53e9b2ee KM |
100 | .PP |
101 | .I Getttynam | |
102 | searches from the beginning of the file until a matching | |
103 | .I name | |
104 | is found | |
105 | (or until EOF is encountered). | |
106 | .SH FILES | |
107 | /etc/ttys | |
108 | .SH "SEE ALSO" | |
06c5d283 | 109 | login(1), ttyslot(3), gettytab(5), termcap(5), ttys(5), getty(8), init(8) |
53e9b2ee | 110 | .SH DIAGNOSTICS |
06c5d283 KB |
111 | The routines |
112 | .I getttyent | |
113 | and | |
114 | .I getttynam | |
115 | return a null pointer on EOF or error. | |
116 | .I Setttyent | |
117 | and | |
118 | .I endttyent | |
119 | return 0 on failure and 1 on success. | |
53e9b2ee | 120 | .SH BUGS |
06c5d283 KB |
121 | All information is contained in a static area so it must be copied if |
122 | it is to be saved. |