Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getservbyname(3N) — UTek W2.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getprotoent(3n)

services(5n)



GETSERVENT(3N)          COMMAND REFERENCE          GETSERVENT(3N)



NAME
     getservent, getservbyport, getservbyname, setservent,
     endservent - get service entry

SYNOPSIS
     #include <netdb.h>

     struct servent *getservent()

     struct servent *getservbyname(name, proto)
     char *name, *proto;

     struct servent *getservbyport(port, proto)
     int port; char *proto;

     setservent(stayopen)
     int stayopen

     endservent()

DESCRIPTION
     Getservent, getservbyname, and getservbyport each return a
     pointer to an object with the following structure containing
     the broken-out fields of a line in the network services data
     base, /etc/services.

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

     The members of this structure are:



     s_name     The official name of the service.

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

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

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



     Getservent reads the next line of the file, opening the file
     if necessary.  The file remains open upon completion.



Printed 10/17/86                                                1





GETSERVENT(3N)          COMMAND REFERENCE          GETSERVENT(3N)



     Getservbyname and getservbyport open the file, if necessary,
     then  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.
     The  file  is  closed  upon  completion.   Port  numbers are
     supplied in network byte order.

     Setservent opens and rewinds the file.  If the stayopen flag
     is  nonzero,  the  service  database  will  not be closed by
     subsequent  calls  to  endservent   (either   directly,   or
     indirectly through one of the other getserv calls).

     Endservent closes the file.

FILES
     /etc/services

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

CAVEATS
     All information is contained in a static area so it must  be
     copied if it is to be saved.

SEE ALSO
     getprotoent(3n), services(5n).




























Printed 10/17/86                                                2





































































%%index%%
na:72,125;
sy:197,1532;
de:1729,1442;3315,1150;
fi:4465,78;
di:4543,127;
ca:4670,151;
se:4821,158;
%%index%%000000000132

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026