summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/getservent.3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libc/net/getservent.338
1 files changed, 13 insertions, 25 deletions
diff --git a/src/lib/libc/net/getservent.3 b/src/lib/libc/net/getservent.3
index 81ebc40cad..85e0d65352 100644
--- a/src/lib/libc/net/getservent.3
+++ b/src/lib/libc/net/getservent.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: getservent.3,v 1.10 2000/12/17 21:30:38 millert Exp $ 1.\" $OpenBSD: getservent.3,v 1.11 2000/12/24 00:30:56 aaron Exp $
2.\" 2.\"
3.\" Copyright (c) 1983, 1991, 1993 3.\" Copyright (c) 1983, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -59,11 +59,8 @@ The
59.Fn getservbyname , 59.Fn getservbyname ,
60and 60and
61.Fn getservbyport 61.Fn getservbyport
62functions 62functions each return a pointer to an object with the following structure
63each return a pointer to an object with the 63containing the broken-out fields of a line in the network services database,
64following structure
65containing the broken-out
66fields of a line in the network services database,
67.Pa /etc/services . 64.Pa /etc/services .
68.Bd -literal -offset indent 65.Bd -literal -offset indent
69struct servent { 66struct servent {
@@ -84,19 +81,16 @@ A zero-terminated list of alternate names for the service.
84The port number at which the service resides. 81The port number at which the service resides.
85Port numbers are returned in network byte order. 82Port numbers are returned in network byte order.
86.It Fa s_proto 83.It Fa s_proto
87The name of the protocol to use when contacting the 84The name of the protocol to use when contacting the service.
88service.
89.El 85.El
90.Pp 86.Pp
91The 87The
92.Fn getservent 88.Fn getservent
93function 89function reads the next line of the file, opening the file if necessary.
94reads the next line of the file, opening the file if necessary.
95.Pp 90.Pp
96The 91The
97.Fn setservent 92.Fn setservent
98function 93function opens and rewinds the file.
99opens and rewinds the file.
100If the 94If the
101.Fa stayopen 95.Fa stayopen
102flag is non-zero, 96flag is non-zero,
@@ -107,19 +101,15 @@ or
107.Pp 101.Pp
108The 102The
109.Fn endservent 103.Fn endservent
110function 104function closes the file.
111closes the file.
112.Pp 105.Pp
113The 106The
114.Fn getservbyname 107.Fn getservbyname
115and 108and
116.Fn getservbyport 109.Fn getservbyport
117functions 110functions sequentially search from the beginning of the file until a
118sequentially search from the beginning 111matching protocol name or port number (specified in network byte order)
119of the file until a matching 112is found, or until
120protocol name or
121port number (specified in network byte order) is found,
122or until
123.Dv EOF 113.Dv EOF
124is encountered. 114is encountered.
125If a protocol name is also supplied (non-null), 115If a protocol name is also supplied (non-null),
@@ -129,8 +119,7 @@ searches must also match the protocol.
129.It Pa /etc/services 119.It Pa /etc/services
130.El 120.El
131.Sh DIAGNOSTICS 121.Sh DIAGNOSTICS
132Null pointer 122Null pointer (0) returned on
133(0) returned on
134.Dv EOF 123.Dv EOF
135or error. 124or error.
136.Sh SEE ALSO 125.Sh SEE ALSO
@@ -147,7 +136,6 @@ and
147functions appeared in 136functions appeared in
148.Bx 4.2 . 137.Bx 4.2 .
149.Sh BUGS 138.Sh BUGS
150These functions use static data storage; 139These functions use static data storage; if the data is needed for future use,
151if the data is needed for future use, it should be 140it should be copied before any subsequent calls overwrite it.
152copied before any subsequent calls overwrite it.
153Expecting port numbers to fit in a 32-bit quantity is probably naive. 141Expecting port numbers to fit in a 32-bit quantity is probably naive.