4.4BSD/usr/share/man/cat3/endservent.0

Compare this file to the similar file:
Show the results in this format:

GETSERVENT(3)               BSD Programmer's Manual              GETSERVENT(3)

NNAAMMEE
     ggeettsseerrvveenntt, ggeettsseerrvvbbyyppoorrtt, ggeettsseerrvvbbyynnaammee, sseettsseerrvveenntt, eennddsseerrvveenntt - get
     service entry

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<nneettddbb..hh>>

     _s_t_r_u_c_t _s_e_r_v_e_n_t _*
     ggeettsseerrvveenntt();

     _s_t_r_u_c_t _s_e_r_v_e_n_t _*
     ggeettsseerrvvbbyynnaammee(_c_h_a_r _*_n_a_m_e, _c_h_a_r _*_p_r_o_t_o);

     _s_t_r_u_c_t _s_e_r_v_e_n_t _*
     ggeettsseerrvvbbyyppoorrtt(_i_n_t _p_o_r_t, _p_r_o_t_o);

     _v_o_i_d
     sseettsseerrvveenntt(_i_n_t _s_t_a_y_o_p_e_n);

     _v_o_i_d
     eennddsseerrvveenntt(_v_o_i_d);

DDEESSCCRRIIPPTTIIOONN
     The ggeettsseerrvveenntt(), ggeettsseerrvvbbyynnaammee(), and ggeettsseerrvvbbyyppoorrtt() functions each re-
     turn a pointer to an object with the following structure containing the
     broken-out fields of a line in the network services data base,
     _/_e_t_c_/_s_e_r_v_i_c_e_s.

           struct  servent {
                   char    *s_name;        /* official name of service */
                   char    **s_aliases;    /* alias list */
                   int     s_port;         /* port service resides at */
                   char    *s_proto;       /* protocol to use */
           };

     The members of this structure are:

     _s___n_a_m_e     The official name of the service.

     _s___a_l_i_a_s_e_s  A zero terminated list of alternate names for the service.

     _s___p_o_r_t     The port number at which the service resides.  Port numbers
                are returned in network byte order.

     _s___p_r_o_t_o    The name of the protocol to use when contacting the service.

     The ggeettsseerrvveenntt() function reads the next line of the file, opening the
     file if necessary.

     The sseettsseerrvveenntt() function opens and rewinds the file.  If the _s_t_a_y_o_p_e_n
     flag is non-zero, the net data base will not be closed after each call to
     ggeettsseerrvvbbyynnaammee() or ggeettsseerrvvbbyyppoorrtt().

     The eennddsseerrvveenntt() function closes the file.

     The ggeettsseerrvvbbyynnaammee() and ggeettsseerrvvbbyyppoorrtt() functions sequentially search
     from the beginning of the file until a matching protocol name or port
     number is found, or until EOF is encountered.  If a protocol name is also
     supplied (non- NULL), searches must also match the protocol.

FFIILLEESS


     /etc/services

DDIIAAGGNNOOSSTTIICCSS
     Null pointer (0) returned on EOF or error.

SSEEEE AALLSSOO
     getprotoent(3),  services(5)

HHIISSTTOORRYY
     The ggeettsseerrvveenntt(), ggeettsseerrvvbbyyppoorrtt(), ggeettsseerrvvbbyynnaammee(), sseettsseerrvveenntt(), and
     eennddsseerrvveenntt() functions appeared in 4.2BSD.

BBUUGGSS
     These functions use static data storage; if the data is needed for future
     use, it should be copied before any subsequent calls overwrite it.  Ex-
     pecting port numbers to fit in a 32 bit quantity is probably naive.

4.2 Berkeley Distribution        June 4, 1993                                2