xref: /openbsd/lib/libc/rpc/getrpcent.3 (revision 404b540a)
1.\"	$OpenBSD: getrpcent.3,v 1.11 2007/05/31 19:19:30 jmc Exp $
2.\"
3.\" Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4.\" unrestricted use provided that this legend is included on all tape
5.\" media and as a part of the software program in whole or part.  Users
6.\" may copy or modify Sun RPC without charge, but are not authorized
7.\" to license or distribute it to anyone else except as part of a product or
8.\" program developed by the user.
9.\"
10.\" SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11.\" WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12.\" PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13.\"
14.\" Sun RPC is provided with no support and without any obligation on the
15.\" part of Sun Microsystems, Inc. to assist in its use, correction,
16.\" modification or enhancement.
17.\"
18.\" SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19.\" INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20.\" OR ANY PART THEREOF.
21.\"
22.\" In no event will Sun Microsystems, Inc. be liable for any lost revenue
23.\" or profits or other special, indirect and consequential damages, even if
24.\" Sun has been advised of the possibility of such damages.
25.\"
26.\" Sun Microsystems, Inc.
27.\" 2550 Garcia Avenue
28.\" Mountain View, California  94043
29.\"
30.Dd $Mdocdate: May 31 2007 $
31.Dt GETRPCENT 3
32.Os
33.Sh NAME
34.Nm getrpcent ,
35.Nm getrpcbyname ,
36.Nm getrpcbynumber ,
37.Nm endrpcent ,
38.Nm setrpcent
39.Nd get RPC entry
40.Sh SYNOPSIS
41.Fd #include <rpc/rpc.h>
42.Ft struct rpcent *
43.Fn getrpcent void
44.Ft struct rpcent *
45.Fn getrpcbyname "char *name"
46.Ft struct rpcent *
47.Fn getrpcbynumber "int number"
48.Ft void
49.Fn setrpcent "int stayopen"
50.Ft void
51.Fn endrpcent void
52.Sh DESCRIPTION
53.Fn getrpcent ,
54.Fn getrpcbyname ,
55and
56.Fn getrpcbynumber ,
57each return a pointer to an object with the
58following structure
59containing the broken-out
60fields of a line in the rpc program number database,
61.Pa /etc/rpc :
62.Bd -literal -offset 2n
63struct rpcent {
64	char	*r_name;	/* name of server for this rpc program */
65	char	**r_aliases;	/* alias list */
66	int	r_number;	/* rpc program number */
67};
68.Ed
69.Pp
70The members of this structure are:
71.Bl -tag -width r_aliases -offset indent
72.It r_name
73The name of the server for this rpc program.
74.It r_aliases
75A zero terminated list of alternate names for the rpc program.
76.It r_number
77The rpc program number for this service.
78.El
79.Pp
80.Fn getrpcent
81reads the next line of the file, opening the file if necessary.
82.Pp
83.Fn setrpcent
84opens and rewinds the file.
85If the
86.Fa stayopen
87flag is non-zero,
88the net database will not be closed after each call to
89.Fn getrpcent
90(either directly, or indirectly through one of
91the other
92.Dq getrpc
93calls).
94.Pp
95.Fn endrpcent
96closes the file.
97.Pp
98.Fn getrpcbyname
99and
100.Fn getrpcbynumber
101sequentially search from the beginning
102of the file until a matching rpc program name or
103program number is found, or until end-of-file is encountered.
104.Sh FILES
105.Pa /etc/rpc
106.Sh DIAGNOSTICS
107A
108.Dv NULL
109pointer is returned on
110.Dv EOF
111or error.
112.Sh SEE ALSO
113.Xr rpc 5 ,
114.Xr rpcinfo 8 ,
115.Xr ypserv 8
116.Sh BUGS
117All information
118is contained in a static area
119so it must be copied if it is
120to be saved.
121