
GETTTYENT(3)               UNIX Programmer's Manual               GETTTYENT(3)

NNAAMMEE
     ggeettttttyyeenntt, ggeettttttyynnaamm, sseettttttyyeenntt, eennddttttyyeenntt - get ttys file entry

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ttttyyeenntt..hh>>

     _s_t_r_u_c_t _t_t_y_e_n_t _*
     ggeettttttyyeenntt()

     _s_t_r_u_c_t _t_t_y_e_n_t _*
     ggeettttttyynnaamm(_c_h_a_r _*_n_a_m_e)

     _i_n_t
     sseettttttyyeenntt(_v_o_i_d)

     _i_n_t
     eennddttttyyeenntt(_v_o_i_d)

DDEESSCCRRIIPPTTIIOONN
     The ggeettttttyyeenntt(), and ggeettttttyynnaamm() functions each return a pointer to an
     object, with the following structure, containing the broken-out fields of
     a line from the tty description file.

     struct ttyent {
             char    *ty_name;       /* terminal device name */
             char    *ty_getty;      /* command to execute */
             char    *ty_type;       /* terminal type */
     #define TTY_ON          0x01    /* enable logins */
     #define TTY_SECURE      0x02    /* allow uid of 0 to login */
             int     ty_status;      /* flag values */
             char    *ty_window;     /* command for window manager */
             char    *ty_comment;    /* comment field */
     };

     The fields are as follows:

     _t_y___n_a_m_e     The name of the character-special file.

     _t_y___g_e_t_t_y    The name of the command invoked by init(8) to initialize tty
                 line characteristics.

     _t_y___t_y_p_e     The name of the default terminal type connected to this tty
                 line.

     _t_y___s_t_a_t_u_s   A mask of bit fields which indicate various actions allowed
                 on this tty line.  The possible flags are as follows:

                 TTY_ON      Enables logins (i.e., init(8) will start the com-
                             mand referenced by _t_y___g_e_t_t_y on this entry).

                 TTY_SECURE  Allow users with a uid of 0 to login on this ter-
                             minal.

     _t_y___w_i_n_d_o_w   The command to execute for a window system associated with
                 the line.

     _t_y___c_o_m_m_e_n_t  Any trailing comment field, with any leading hash marks
                 (``#'') or whitespace removed.

     If any of the fields pointing to character strings are unspecified, they
     are returned as null pointers.  The field _t_y___s_t_a_t_u_s will be zero if no
     flag values are specified.

     See ttys(5) for a more complete discussion of the meaning and usage of
     the fields.

     The ggeettttttyyeenntt() function reads the next line from the ttys file, opening
     the file if necessary.  The sseettttttyyeenntt() function rewinds the file if
     open, or opens the file if it is unopened.  The eennddttttyyeenntt() function
     closes any open files.

     The ggeettttttyynnaamm() function searches from the beginning of the file until a
     matching _n_a_m_e is found (or until EOF is encountered).

RREETTUURRNN VVAALLUUEESS
     The routines ggeettttttyyeenntt() and ggeettttttyynnaamm() return a null pointer on EOF or
     error.  The sseettttttyyeenntt() function and eennddttttyyeenntt() return 0 on failure and
     1 on success.

FFIILLEESS
     /etc/ttys

SSEEEE AALLSSOO
     login(1),  ttyslot(3),  gettytab(5),  termcap(5),  ttys(5),  getty(8),
     init(8)

HHIISSTTOORRYY
     The ggeettttttyyeenntt(), ggeettttttyynnaamm(), sseettttttyyeenntt(), and eennddttttyyeenntt() functions ap-
     peared in 4.3BSD.

BBUUGGSS
     These functions use static data storage; if the data is needed for future
     use, it should be copied before any subsequent calls overwrite it.

4.3 Berkeley Distribution       April 19, 1991                               2


































