xref: /dragonfly/lib/libc/rpc/getrpcent.3 (revision 2cd2d2b5)
1.\" @(#)getrpcent.3n	2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI
2.\" $FreeBSD: src/lib/libc/rpc/getrpcent.3,v 1.11.2.3 2001/12/14 18:33:56 ru Exp $
3.\" $DragonFly: src/lib/libc/rpc/getrpcent.3,v 1.2 2003/06/17 04:26:44 dillon Exp $
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 SYNOPSIS
16.In rpc/rpc.h
17.Ft struct rpcent *
18.Fn getrpcent void
19.Ft struct rpcent *
20.Fn getrpcbyname "char *name"
21.Ft struct rpcent *
22.Fn getrpcbynumber "int number"
23.Ft void
24.Fn setrpcent "int stayopen"
25.Ft void
26.Fn endrpcent void
27.Sh DESCRIPTION
28The
29.Fn getrpcent ,
30.Fn getrpcbyname ,
31and
32.Fn getrpcbynumber
33functions each return a pointer to an object with the
34following structure
35containing the broken-out
36fields of a line in the rpc program number data base,
37.Pa /etc/rpc .
38.Bd -literal
39
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_aliasesxxx
49.It Fa r_name
50The name of the server for this rpc program.
51.It Fa r_aliases
52A zero terminated list of alternate names for the rpc program.
53.It Fa r_number
54The rpc program number for this service.
55.El
56.Pp
57The
58.Fn getrpcent
59function reads the next line of the file, opening the file if necessary.
60The
61.Fn setrpcent
62function opens and rewinds the file.  If the
63.Fa stayopen
64flag is non-zero,
65the net data base will not be closed after each call to
66.Fn getrpcent
67(either directly, or indirectly through one of
68the other
69.Fn getrpcent
70function family.
71.Pp
72.Fn endrpcent
73closes the file.
74.Pp
75.Fn getrpcbyname
76and
77.Fn getrpcbynumber
78sequentially search from the beginning
79of the file until a matching rpc program name or
80program number is found, or until end-of-file is encountered.
81.Sh FILES
82.Bl -tag -width /etc/rpc -compact
83.It Pa /etc/rpc
84.El
85.Sh "SEE ALSO"
86.Xr rpc 5 ,
87.Xr rpcinfo 8 ,
88.Xr ypserv 8
89.Sh DIAGNOSTICS
90A
91.Dv NULL
92pointer is returned on
93.Dv EOF
94or error.
95.Sh BUGS
96All information
97is contained in a static area
98so it must be copied if it is
99to be saved.
100