xref: /openbsd/lib/libc/rpc/getrpcent.3 (revision 771fbea0)
1.\"	$OpenBSD: getrpcent.3,v 1.13 2013/06/05 03:39:23 tedu Exp $
2.\"
3.\" Copyright (c) 2010, Oracle America, Inc.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions are
7.\" met:
8.\"
9.\"     * Redistributions of source code must retain the above copyright
10.\"       notice, this list of conditions and the following disclaimer.
11.\"     * Redistributions in binary form must reproduce the above
12.\"       copyright notice, this list of conditions and the following
13.\"       disclaimer in the documentation and/or other materials
14.\"       provided with the distribution.
15.\"     * Neither the name of the "Oracle America, Inc." nor the names of its
16.\"       contributors may be used to endorse or promote products derived
17.\"       from this software without specific prior written permission.
18.\"
19.\"   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20.\"   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21.\"   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22.\"   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23.\"   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24.\"   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\"   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26.\"   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27.\"   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28.\"   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29.\"   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30.\"   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31.\"
32.Dd $Mdocdate: June 5 2013 $
33.Dt GETRPCENT 3
34.Os
35.Sh NAME
36.Nm getrpcent ,
37.Nm getrpcbyname ,
38.Nm getrpcbynumber ,
39.Nm endrpcent ,
40.Nm setrpcent
41.Nd get RPC entry
42.Sh SYNOPSIS
43.In rpc/rpc.h
44.Ft struct rpcent *
45.Fn getrpcent void
46.Ft struct rpcent *
47.Fn getrpcbyname "char *name"
48.Ft struct rpcent *
49.Fn getrpcbynumber "int number"
50.Ft void
51.Fn setrpcent "int stayopen"
52.Ft void
53.Fn endrpcent void
54.Sh DESCRIPTION
55.Fn getrpcent ,
56.Fn getrpcbyname ,
57and
58.Fn getrpcbynumber ,
59each return a pointer to an object with the
60following structure
61containing the broken-out
62fields of a line in the rpc program number database,
63.Pa /etc/rpc :
64.Bd -literal -offset 2n
65struct rpcent {
66	char	*r_name;	/* name of server for this rpc program */
67	char	**r_aliases;	/* alias list */
68	int	r_number;	/* rpc program number */
69};
70.Ed
71.Pp
72The members of this structure are:
73.Bl -tag -width r_aliases -offset indent
74.It r_name
75The name of the server for this rpc program.
76.It r_aliases
77A zero terminated list of alternate names for the rpc program.
78.It r_number
79The rpc program number for this service.
80.El
81.Pp
82.Fn getrpcent
83reads the next line of the file, opening the file if necessary.
84.Pp
85.Fn setrpcent
86opens and rewinds the file.
87If the
88.Fa stayopen
89flag is non-zero,
90the net database will not be closed after each call to
91.Fn getrpcent
92(either directly, or indirectly through one of
93the other
94.Dq getrpc
95calls).
96.Pp
97.Fn endrpcent
98closes the file.
99.Pp
100.Fn getrpcbyname
101and
102.Fn getrpcbynumber
103sequentially search from the beginning
104of the file until a matching rpc program name or
105program number is found, or until end-of-file is encountered.
106.Sh FILES
107.Pa /etc/rpc
108.Sh DIAGNOSTICS
109A
110.Dv NULL
111pointer is returned on
112.Dv EOF
113or error.
114.Sh SEE ALSO
115.Xr rpc 5 ,
116.Xr rpcinfo 8 ,
117.Xr ypserv 8
118.Sh BUGS
119All information
120is contained in a static area
121so it must be copied if it is
122to be saved.
123