fts_load no longer has any return value
[unix-history] / usr / src / lib / libc / net / getprotoent.3
CommitLineData
56e6bd55
KB
1.\" Copyright (c) 1983 The Regents of the University of California.
2.\" All rights reserved.
d148e37f 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
d148e37f 5.\"
91cff1e1 6.\" @(#)getprotoent.3 6.5 (Berkeley) %G%
56e6bd55
KB
7.\"
8.TH GETPROTOENT 3 ""
d148e37f
KM
9.UC 5
10.SH NAME
56e6bd55
KB
11getprotoent, getprotobynumber, getprotobyname, setprotoent,
12endprotoent \- get protocol entry
d148e37f
KM
13.SH SYNOPSIS
14.nf
15.ft B
16.B #include <netdb.h>
17.PP
18.ft B
19struct protoent *getprotoent()
20.PP
21.ft B
22struct protoent *getprotobyname(name)
23char *name;
24.PP
25.ft B
26struct protoent *getprotobynumber(proto)
27int proto;
28.PP
29.ft B
30setprotoent(stayopen)
31int stayopen
32.PP
33.ft B
34endprotoent()
35.fi
36.SH DESCRIPTION
37.IR Getprotoent ,
38.IR getprotobyname ,
39and
40.I getprotobynumber
41each return a pointer to an object with the
42following structure
43containing the broken-out
44fields of a line in the network protocol data base,
45.IR /etc/protocols .
46.RS
47.PP
48.nf
49struct protoent {
50 char *p_name; /* official name of protocol */
51 char **p_aliases; /* alias list */
50159ed7 52 int p_proto; /* protocol number */
d148e37f
KM
53};
54.ft R
55.ad
56.fi
57.RE
58.PP
59The members of this structure are:
60.TP \w'p_aliases'u+2n
61p_name
62The official name of the protocol.
63.TP \w'p_aliases'u+2n
64p_aliases
65A zero terminated list of alternate names for the protocol.
66.TP \w'p_aliases'u+2n
67p_proto
68The protocol number.
69.PP
70.I Getprotoent
71reads the next line of the file, opening the file if necessary.
72.PP
73.I Setprotoent
74opens and rewinds the file. If the
75.I stayopen
76flag is non-zero,
77the net data base will not be closed after each call to
ec178508
JL
78.I getprotobyname
79or
80.IR getprotobynumber .
d148e37f
KM
81.PP
82.I Endprotoent
83closes the file.
84.PP
85.I Getprotobyname
86and
87.I getprotobynumber
88sequentially search from the beginning
89of the file until a matching
90protocol name or
91protocol number is found,
92or until EOF is encountered.
93.SH FILES
94/etc/protocols
95.SH "SEE ALSO"
96protocols(5)
97.SH DIAGNOSTICS
98Null pointer
99(0) returned on EOF or error.
100.SH BUGS
101All information
102is contained in a static area
103so it must be copied if it is
104to be saved. Only the Internet
105protocols are currently understood.