xref: /freebsd/lib/libc/rpc/getrpcent.3 (revision 8aac90f18aef7c9eea906c3ff9a001ca7b94f375)
1.\" $NetBSD: getrpcent.3,v 1.6 1998/02/05 18:49:06 perry Exp $
2.\"
3.Dd February 26, 2016
4.Dt GETRPCENT 3
5.Os
6.Sh NAME
7.Nm getrpcent ,
8.Nm getrpcbyname ,
9.Nm getrpcbynumber ,
10.Nm endrpcent ,
11.Nm setrpcent
12.Nd get RPC entry
13.Sh LIBRARY
14.Lb libc
15.Sh SYNOPSIS
16.In rpc/rpc.h
17.Ft struct rpcent *
18.Fn getrpcent void
19.Ft struct rpcent *
20.Fn getrpcbyname "const 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
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
57The
58.Fn getrpcent
59function
60reads the next line of the file, opening the file if necessary.
61.Pp
62The
63.Fn setrpcent
64function
65opens and rewinds the file.
66If the
67.Fa stayopen
68flag is non-zero,
69the net data base will not be closed after each call to
70.Fn getrpcent
71(either directly, or indirectly through one of
72the other
73.Dq getrpc
74calls).
75.Pp
76The
77.Fn endrpcent
78function
79closes the file.
80.Pp
81The
82.Fn getrpcbyname
83and
84.Fn getrpcbynumber
85functions
86sequentially search from the beginning
87of the file until a matching rpc program name or
88program number is found, or until end-of-file is encountered.
89.Sh FILES
90.Bl -tag -width /etc/rpc -compact
91.It Pa /etc/rpc
92.El
93.Sh DIAGNOSTICS
94A
95.Dv NULL
96pointer is returned on
97.Dv EOF
98or error.
99.Sh SEE ALSO
100.Xr rpc 5 ,
101.Xr rpcinfo 8 ,
102.Xr ypserv 8
103.Sh BUGS
104All information
105is contained in a static area
106so it must be copied if it is
107to be saved.
108