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