]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getprotoent.3
Convert function formatting of the form "\fBname\fP()" to ".BR name ()".
[thirdparty/man-pages.git] / man3 / getprotoent.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\" 386BSD man pages
27 .\" Modified Sat Jul 24 19:26:03 1993 by Rik Faith (faith@cs.unc.edu)
28 .TH GETPROTOENT 3 1993-04-24 "BSD" "Linux Programmer's Manual"
29 .SH NAME
30 getprotoent, getprotobyname, getprotobynumber, setprotoent,
31 endprotoent \- get protocol entry
32 .SH SYNOPSIS
33 .nf
34 .B #include <netdb.h>
35 .sp
36 .B struct protoent *getprotoent(void);
37 .sp
38 .BI "struct protoent *getprotobyname(const char *" name );
39 .sp
40 .BI "struct protoent *getprotobynumber(int " proto );
41 .sp
42 .BI "void setprotoent(int " stayopen );
43 .sp
44 .B void endprotoent(void);
45 .fi
46 .SH DESCRIPTION
47 The
48 .BR getprotoent ()
49 function reads the next line from the file
50 \fI/etc/protocols\fP and returns a structure \fIprotoent\fP
51 containing the broken out fields from the line.
52 The \fI/etc/protocols\fP file is opened if necessary.
53 .PP
54 The
55 .BR getprotobyname ()
56 function returns a \fIprotoent\fP
57 structure for the line from \fI/etc/protocols\fP that matches
58 the protocol name \fIname\fP.
59 .PP
60 The
61 .BR getprotobynumber ()
62 function returns a \fIprotoent\fP
63 structure for the line that matches the protocol number \fInumber\fP.
64 .PP
65 The
66 .BR setprotoent ()
67 function opens and rewinds the
68 \fI/etc/protocols\fP file.
69 If \fIstayopen\fP is true (1), then
70 the file will not be closed between calls to
71 .BR getprotobyname ()
72 or
73 .BR getprotobynumber ().
74 .PP
75 The
76 .BR endprotoent ()
77 function closes \fI/etc/protocols\fP.
78 .PP
79 The \fIprotoent\fP structure is defined in \fI<netdb.h>\fP as follows:
80 .sp
81 .in +0.5i
82 .nf
83 struct protoent {
84 char *p_name; /* official protocol name */
85 char **p_aliases; /* alias list */
86 int p_proto; /* protocol number */
87 }
88 .fi
89 .in -0.5i
90 .PP
91 The members of the \fIprotoent\fP structure are:
92 .TP
93 .I p_name
94 The official name of the protocol.
95 .TP
96 .I p_aliases
97 A zero terminated list of alternative names for the protocol.
98 .TP
99 .I p_proto
100 The protocol number.
101 .SH "RETURN VALUE"
102 The
103 .BR getprotoent (),
104 .BR getprotobyname ()
105 and
106 .BR getprotobynumber ()
107 functions return the \fIprotoent\fP structure, or a NULL pointer if an
108 error occurs or the end of the file is reached.
109 .SH FILES
110 .PD 0
111 .TP
112 .I /etc/protocols
113 protocol database file
114 .PD
115 .SH "CONFORMING TO"
116 4.3BSD, POSIX.1-2001.
117 .SH "SEE ALSO"
118 .BR getnetent (3),
119 .BR getservent (3),
120 .BR protocols (5)