xref: /freebsd/lib/libc/rpc/getrpcent.3 (revision 2b15cb3d0922bd70ea592f0da9b4a5b167f4d53f)
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.In 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
30The
31.Fn getrpcent ,
32.Fn getrpcbyname ,
33and
34.Fn getrpcbynumber
35functions
36each return a pointer to an object with the
37following structure
38containing the broken-out
39fields of a line in the rpc program number data base,
40.Pa /etc/rpc :
41.Bd -literal
42struct rpcent {
43	char	*r_name;	/* name of server for this rpc program */
44	char	**r_aliases;	/* alias list */
45	long	r_number;	/* rpc program number */
46};
47.Ed
48.Pp
49The members of this structure are:
50.Bl -tag -width r_aliases -offset indent
51.It Va r_name
52The name of the server for this rpc program.
53.It Va r_aliases
54A zero terminated list of alternate names for the rpc program.
55.It Va r_number
56The rpc program number for this service.
57.El
58.Pp
59The
60.Fn getrpcent
61function
62reads the next line of the file, opening the file if necessary.
63.Pp
64The
65.Fn setrpcent
66function
67opens and rewinds the file.
68If the
69.Fa stayopen
70flag is non-zero,
71the net data base will not be closed after each call to
72.Fn getrpcent
73(either directly, or indirectly through one of
74the other
75.Dq getrpc
76calls).
77.Pp
78The
79.Fn endrpcent
80function
81closes the file.
82.Pp
83The
84.Fn getrpcbyname
85and
86.Fn getrpcbynumber
87functions
88sequentially search from the beginning
89of the file until a matching rpc program name or
90program number is found, or until end-of-file is encountered.
91.Sh FILES
92.Bl -tag -width /etc/rpc -compact
93.It Pa /etc/rpc
94.El
95.Sh DIAGNOSTICS
96A
97.Dv NULL
98pointer is returned on
99.Dv EOF
100or error.
101.Sh SEE ALSO
102.Xr rpc 5 ,
103.Xr rpcinfo 8 ,
104.Xr ypserv 8
105.Sh BUGS
106All information
107is contained in a static area
108so it must be copied if it is
109to be saved.
110