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

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

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

NNAAMMEE
     ggeettpprroottooeenntt, ggeettpprroottoobbyynnuummbbeerr, ggeettpprroottoobbyynnaammee, sseettpprroottooeenntt, eennddpprroottooeenntt -
     get protocol entry

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

     _s_t_r_u_c_t _p_r_o_t_o_e_n_t _*
     ggeettpprroottooeenntt();

     _s_t_r_u_c_t _p_r_o_t_o_e_n_t _*
     ggeettpprroottoobbyynnaammee(_c_h_a_r _*_n_a_m_e);

     _s_t_r_u_c_t _p_r_o_t_o_e_n_t _*
     ggeettpprroottoobbyynnuummbbeerr(_i_n_t _p_r_o_t_o);

     sseettpprroottooeenntt(_i_n_t _s_t_a_y_o_p_e_n);

     eennddpprroottooeenntt();

DDEESSCCRRIIPPTTIIOONN
     The ggeettpprroottooeenntt(), ggeettpprroottoobbyynnaammee(), and ggeettpprroottoobbyynnuummbbeerr() functions
     each return a pointer to an object with the following structure contain-
     ing the broken-out fields of a line in the network protocol data base,
     _/_e_t_c_/_p_r_o_t_o_c_o_l_s.


           struct  protoent {
                   char    *p_name;        /* official name of protocol */
                   char    **p_aliases;    /* alias list */
                   int     p_proto;        /* protocol number */
           };

     The members of this structure are:

     _p___n_a_m_e     The official name of the protocol.

     _p___a_l_i_a_s_e_s  A zero terminated list of alternate names for the protocol.

     _p___p_r_o_t_o    The protocol number.

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

     The sseettpprroottooeenntt() 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
     ggeettpprroottoobbyynnaammee() or ggeettpprroottoobbyynnuummbbeerr().

     The eennddpprroottooeenntt() function closes the file.

     The ggeettpprroottoobbyynnaammee() function and ggeettpprroottoobbyynnuummbbeerr() sequentially search
     from the beginning of the file until a matching protocol name or protocol
     number is found, or until EOF is encountered.

RREETTUURRNN VVAALLUUEESS
     Null pointer (0) returned on EOF or error.

FFIILLEESS
     /etc/protocols

SSEEEE AALLSSOO
     protocols(5)

HHIISSTTOORRYY
     The ggeettpprroottooeenntt(), ggeettpprroottoobbyynnuummbbeerr(), ggeettpprroottoobbyynnaammee(), sseettpprroottooeenntt(),
     and eennddpprroottooeenntt() functions appeared in 4.2BSD.

BBUUGGSS
     These functions use a static data space; if the data is needed for future
     use, it should be copied before any subsequent calls overwrite it.  Only
     the Internet protocols are currently understood.

4.2 Berkeley Distribution        June 4, 1993                                2