Annotation of 43BSDReno/lib/libc/net/getservent.3, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1983 The Regents of the University of California.
                      2: .\" All rights reserved.
                      3: .\"
                      4: .\" Redistribution and use in source and binary forms are permitted provided
                      5: .\" that: (1) source distributions retain this entire copyright notice and
                      6: .\" comment, and (2) distributions including binaries display the following
                      7: .\" acknowledgement:  ``This product includes software developed by the
                      8: .\" University of California, Berkeley and its contributors'' in the
                      9: .\" documentation or other materials provided with the distribution and in
                     10: .\" all advertising materials mentioning features or use of this software.
                     11: .\" Neither the name of the University nor the names of its contributors may
                     12: .\" be used to endorse or promote products derived from this software without
                     13: .\" specific prior written permission.
                     14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     17: .\"
                     18: .\"    @(#)getservent.3        6.5 (Berkeley) 6/23/90
                     19: .\"
                     20: .TH GETSERVENT 3 "June 23, 1990"
                     21: .UC 5
                     22: .SH NAME
                     23: getservent, getservbyport, getservbyname, setservent,
                     24: endservent \- get service entry
                     25: .SH SYNOPSIS
                     26: .nf
                     27: .ft B
                     28: #include <netdb.h>
                     29: .PP
                     30: .ft B
                     31: struct servent *getservent()
                     32: .PP
                     33: .ft B
                     34: struct servent *getservbyname(name, proto)
                     35: char *name, *proto;
                     36: .PP
                     37: .ft B
                     38: struct servent *getservbyport(port, proto)
                     39: int port; char *proto;
                     40: .PP
                     41: .ft B
                     42: setservent(stayopen)
                     43: int stayopen
                     44: .PP
                     45: .ft B
                     46: endservent()
                     47: .fi
                     48: .SH DESCRIPTION
                     49: .IR Getservent ,
                     50: .IR getservbyname ,
                     51: and
                     52: .I getservbyport
                     53: each return a pointer to an object with the
                     54: following structure
                     55: containing the broken-out
                     56: fields of a line in the network services data base,
                     57: .IR /etc/services .
                     58: .RS
                     59: .PP
                     60: .nf
                     61: struct servent {
                     62:        char    *s_name;        /* official name of service */
                     63:        char    **s_aliases;    /* alias list */
                     64:        int     s_port;         /* port service resides at */
                     65:        char    *s_proto;       /* protocol to use */
                     66: };
                     67: .ft R
                     68: .ad
                     69: .fi
                     70: .RE
                     71: .PP
                     72: The members of this structure are:
                     73: .TP \w's_aliases'u+2n
                     74: s_name
                     75: The official name of the service.
                     76: .TP \w's_aliases'u+2n
                     77: s_aliases
                     78: A zero terminated list of alternate names for the service.
                     79: .TP \w's_aliases'u+2n
                     80: s_port
                     81: The port number at which the service resides.
                     82: Port numbers are returned in network byte order.
                     83: .TP \w's_aliases'u+2n
                     84: s_proto
                     85: The name of the protocol to use when contacting the
                     86: service.
                     87: .PP
                     88: .I Getservent
                     89: reads the next line of the file, opening the file if necessary.
                     90: .PP
                     91: .I Setservent
                     92: opens and rewinds the file.  If the
                     93: .I stayopen
                     94: flag is non-zero,
                     95: the net data base will not be closed after each call to 
                     96: .I getservbyname
                     97: or .IR getservbyport .
                     98: .PP
                     99: .I Endservent
                    100: closes the file.
                    101: .PP
                    102: .I Getservbyname
                    103: and
                    104: .I getservbyport
                    105: sequentially search from the beginning
                    106: of the file until a matching
                    107: protocol name or
                    108: port number is found,
                    109: or until EOF is encountered.
                    110: If a protocol name is also supplied (non-NULL),
                    111: searches must also match the protocol.
                    112: .SH FILES
                    113: /etc/services
                    114: .SH "SEE ALSO"
                    115: getprotoent(3), services(5)
                    116: .SH DIAGNOSTICS
                    117: Null pointer
                    118: (0) returned on EOF or error.
                    119: .SH BUGS
                    120: All information
                    121: is contained in a static area
                    122: so it must be copied if it is
                    123: to be saved.  Expecting port
                    124: numbers to fit in a 32 bit
                    125: 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.