1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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"
30 getprotoent, getprotobyname, getprotobynumber, setprotoent,
31 endprotoent \- get protocol entry
36 .B struct protoent *getprotoent(void);
38 .BI "struct protoent *getprotobyname(const char *" name );
40 .BI "struct protoent *getprotobynumber(int " proto );
42 .BI "void setprotoent(int " stayopen );
44 .B void endprotoent(void);
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.
56 function returns a \fIprotoent\fP
57 structure for the line from \fI/etc/protocols\fP that matches
58 the protocol name \fIname\fP.
61 .BR getprotobynumber ()
62 function returns a \fIprotoent\fP
63 structure for the line that matches the protocol number \fInumber\fP.
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
73 .BR getprotobynumber ().
77 function closes \fI/etc/protocols\fP.
79 The \fIprotoent\fP structure is defined in \fI<netdb.h>\fP as follows:
84 char *p_name; /* official protocol name */
85 char **p_aliases; /* alias list */
86 int p_proto; /* protocol number */
91 The members of the \fIprotoent\fP structure are:
94 The official name of the protocol.
97 A zero terminated list of alternative names for the protocol.
104 .BR getprotobyname ()
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.
113 protocol database file
116 4.3BSD, POSIX.1-2001.