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