1GETTTYENT(3) 386BSD Programmer's Manual GETTTYENT(3) 2 3NNAAMMEE 4 ggeettttttyyeenntt, ggeettttttyynnaamm, sseettttttyyeenntt, eennddttttyyeenntt - get ttys file entry 5 6SSYYNNOOPPSSIISS 7 ##iinncclluuddee <<ttttyyeenntt..hh>> 8 9 _s_t_r_u_c_t _t_t_y_e_n_t * 10 ggeettttttyyeenntt() 11 12 _s_t_r_u_c_t _t_t_y_e_n_t * 13 ggeettttttyynnaamm(_c_h_a_r *_n_a_m_e) 14 15 _i_n_t 16 sseettttttyyeenntt(_v_o_i_d) 17 18 _i_n_t 19 eennddttttyyeenntt(_v_o_i_d) 20 21DDEESSCCRRIIPPTTIIOONN 22 The ggeettttttyyeenntt(), and ggeettttttyynnaamm() functions each return a pointer to an 23 object, with the following structure, containing the broken-out fields of 24 a line from the tty description file. 25 26 struct ttyent { 27 char *ty_name; /* terminal device name */ 28 char *ty_getty; /* command to execute */ 29 char *ty_type; /* terminal type */ 30 #define TTY_ON 0x01 /* enable logins */ 31 #define TTY_SECURE 0x02 /* allow uid of 0 to login */ 32 int ty_status; /* flag values */ 33 char *ty_window; /* command for window manager */ 34 char *ty_comment; /* comment field */ 35 }; 36 37 The fields are as follows: 38 39 _t_y__n_a_m_e The name of the character-special file. 40 41 _t_y__g_e_t_t_y The name of the command invoked by init(8) to initialize tty 42 line characteristics. 43 44 _t_y__t_y_p_e The name of the default terminal type connected to this tty 45 line. 46 47 _t_y__s_t_a_t_u_s A mask of bit fields which indicate various actions allowed 48 on this tty line. The possible flags are as follows: 49 50 TTY_ON Enables logins (i.e., init(8) will start the 51 command referenced by _t_y__g_e_t_t_y on this entry). 52 53 TTY_SECURE Allow users with a uid of 0 to login on this 54 terminal. 55 56 _t_y__w_i_n_d_o_w The command to execute for a window system associated with 57 the line. 58 59 _t_y__c_o_m_m_e_n_t Any trailing comment field, with any leading hash marks 60 (``#'') or whitespace removed. 61 62 If any of the fields pointing to character strings are unspecified, they 63 are returned as null pointers. The field _t_y__s_t_a_t_u_s will be zero if no 64 flag values are specified. 65 66 67 See ttys(5) for a more complete discussion of the meaning and usage of 68 the fields. 69 70 The ggeettttttyyeenntt() function reads the next line from the ttys file, opening 71 the file if necessary. The sseettttttyyeenntt() function rewinds the file if 72 open, or opens the file if it is unopened. The eennddttttyyeenntt() function 73 closes any open files. 74 75 The ggeettttttyynnaamm() function searches from the beginning of the file until a 76 matching _n_a_m_e is found (or until EOF is encountered). 77 78RREETTUURRNN VVAALLUUEESS 79 The routines ggeettttttyyeenntt() and ggeettttttyynnaamm() return a null pointer on EOF or 80 error. The sseettttttyyeenntt() function and eennddttttyyeenntt() return 0 on failure and 81 1 on success. 82 83FFIILLEESS 84 /etc/ttys 85 86SSEEEE AALLSSOO 87 login(1), ttyslot(3), gettytab(5), termcap(5), ttys(5), getty(8), 88 init(8) 89 90HHIISSTTOORRYY 91 The ggeettttttyyeenntt(), ggeettttttyynnaamm(), sseettttttyyeenntt(), and eennddttttyyeenntt() functions 92 appeared in 4.3BSD. 93 94BBUUGGSS 95 These functions use static data storage; if the data is needed for future 96 use, it should be copied before any subsequent calls overwrite it. 97 984.3 Berkeley Distribution April 19, 1991 2 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133