Annotation of 43BSDTahoe/man/man3/getservent.3, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1983 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)getservent.3n       6.3 (Berkeley) 5/19/86
                      6: .\"
                      7: .TH GETSERVENT 3N "May 19, 1986"
                      8: .UC 5
                      9: .SH NAME
                     10: getservent, getservbyport, getservbyname, setservent, endservent \- get service entry
                     11: .SH SYNOPSIS
                     12: .nf
                     13: .ft B
                     14: #include <netdb.h>
                     15: .PP
                     16: .ft B
                     17: struct servent *getservent()
                     18: .PP
                     19: .ft B
                     20: struct servent *getservbyname(name, proto)
                     21: char *name, *proto;
                     22: .PP
                     23: .ft B
                     24: struct servent *getservbyport(port, proto)
                     25: int port; char *proto;
                     26: .PP
                     27: .ft B
                     28: setservent(stayopen)
                     29: int stayopen
                     30: .PP
                     31: .ft B
                     32: endservent()
                     33: .fi
                     34: .SH DESCRIPTION
                     35: .IR Getservent ,
                     36: .IR getservbyname ,
                     37: and
                     38: .I getservbyport
                     39: each return a pointer to an object with the
                     40: following structure
                     41: containing the broken-out
                     42: fields of a line in the network services data base,
                     43: .IR /etc/services .
                     44: .RS
                     45: .PP
                     46: .nf
                     47: struct servent {
                     48:        char    *s_name;        /* official name of service */
                     49:        char    **s_aliases;    /* alias list */
                     50:        int     s_port;         /* port service resides at */
                     51:        char    *s_proto;       /* protocol to use */
                     52: };
                     53: .ft R
                     54: .ad
                     55: .fi
                     56: .RE
                     57: .PP
                     58: The members of this structure are:
                     59: .TP \w's_aliases'u+2n
                     60: s_name
                     61: The official name of the service.
                     62: .TP \w's_aliases'u+2n
                     63: s_aliases
                     64: A zero terminated list of alternate names for the service.
                     65: .TP \w's_aliases'u+2n
                     66: s_port
                     67: The port number at which the service resides.
                     68: Port numbers are returned in network byte order.
                     69: .TP \w's_aliases'u+2n
                     70: s_proto
                     71: The name of the protocol to use when contacting the
                     72: service.
                     73: .PP
                     74: .I Getservent
                     75: reads the next line of the file, opening the file if necessary.
                     76: .PP
                     77: .I Setservent
                     78: opens and rewinds the file.  If the
                     79: .I stayopen
                     80: flag is non-zero,
                     81: the net data base will not be closed after each call to 
                     82: .I getservbyname
                     83: or .IR getservbyport .
                     84: .PP
                     85: .I Endservent
                     86: closes the file.
                     87: .PP
                     88: .I Getservbyname
                     89: and
                     90: .I getservbyport
                     91: sequentially search from the beginning
                     92: of the file until a matching
                     93: protocol name or
                     94: port number is found,
                     95: or until EOF is encountered.
                     96: If a protocol name is also supplied (non-NULL),
                     97: searches must also match the protocol.
                     98: .SH FILES
                     99: /etc/services
                    100: .SH "SEE ALSO"
                    101: getprotoent(3N), services(5)
                    102: .SH DIAGNOSTICS
                    103: Null pointer
                    104: (0) returned on EOF or error.
                    105: .SH BUGS
                    106: All information
                    107: is contained in a static area
                    108: so it must be copied if it is
                    109: to be saved.  Expecting port
                    110: numbers to fit in a 32 bit
                    111: quantity is probably naive.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.