xref: /freebsd/lib/libc/rpc/getrpcent.3 (revision 6990ffd8a95caaba6858ad44ff1b3157d1efba8f)
1.\" @(#)getrpcent.3n	2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI
2.\" $NetBSD: getrpcent.3,v 1.6 1998/02/05 18:49:06 perry Exp $
3.\" $FreeBSD$
4.\"
5.Dd December 14, 1987
6.Dt GETRPCENT 3
7.Os
8.Sh NAME
9.Nm getrpcent ,
10.Nm getrpcbyname ,
11.Nm getrpcbynumber ,
12.Nm endrpcent ,
13.Nm setrpcent
14.Nd get RPC entry
15.Sh LIBRARY
16.Lb libc
17.Sh SYNOPSIS
18.Fd #include <rpc/rpc.h>
19.Ft struct rpcent *
20.Fn getrpcent void
21.Ft struct rpcent *
22.Fn getrpcbyname "char *name"
23.Ft struct rpcent *
24.Fn getrpcbynumber "int number"
25.Ft void
26.Fn setrpcent "int stayopen"
27.Ft void
28.Fn endrpcent void
29.Sh DESCRIPTION
30.Fn getrpcent ,
31.Fn getrpcbyname ,
32and
33.Fn getrpcbynumber
34each return a pointer to an object with the
35following structure
36containing the broken-out
37fields of a line in the rpc program number data base,
38.Pa /etc/rpc :
39.Bd -literal
40struct rpcent {
41	char	*r_name;	/* name of server for this rpc program */
42	char	**r_aliases;	/* alias list */
43	long	r_number;	/* rpc program number */
44};
45.Ed
46.Pp
47The members of this structure are:
48.Bl -tag -width r_aliases -offset indent
49.It Va r_name
50The name of the server for this rpc program.
51.It Va r_aliases
52A zero terminated list of alternate names for the rpc program.
53.It Va r_number
54The rpc program number for this service.
55.El
56.Pp
57.Fn getrpcent
58reads the next line of the file, opening the file if necessary.
59.Pp
60.Fn setrpcent
61opens and rewinds the file.  If the
62.Fa stayopen
63flag is non-zero,
64the net data base will not be closed after each call to
65.Fn getrpcent
66(either directly, or indirectly through one of
67the other
68.Dq getrpc
69calls).
70.Pp
71.Fn endrpcent
72closes the file.
73.Pp
74.Fn getrpcbyname
75and
76.Fn getrpcbynumber
77sequentially search from the beginning
78of the file until a matching rpc program name or
79program number is found, or until end-of-file is encountered.
80.Sh FILES
81.Bl -tag -width /etc/rpc -compact
82.It Pa /etc/rpc
83.El
84.Sh SEE ALSO
85.Xr rpc 5 ,
86.Xr rpcinfo 8 ,
87.Xr ypserv 8
88.Sh DIAGNOSTICS
89A
90.Dv NULL
91pointer is returned on
92.Dv EOF
93or error.
94.Sh BUGS
95All information
96is contained in a static area
97so it must be copied if it is
98to be saved.
99