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